Project H - A bit of the past! [PHP, MySQLi, APC, WinCache]

Page 1 of 14 12345678911 ... LastLast
Results 1 to 15 of 206
  1. #1
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Project H - A bit of the past! [PHP, MySQLi, APC, WinCache, Multilingual]




    What is Project H?
    Project H is an advanced Habbo content management system built upon an older version of Project Baal. The goal of this project is to bring back the old Habbo design but remain up to date with the current release of Habbo. Project H is going to be released completely open source for anyone to make modifications to, however I request that the original copyright be remained intact but feel free to add yourself to the contributors list. Throughout the development cycle there will be a live test, link(s) will be posted in the future, the live test will also allow people to access the client so it's not just a website viewing. Project H is built upon an older source of Project Baal's CMS from around October 2011 that TheJacob and I worked on. I have been working on this project, slowly and on and off for about a month now and I thought it would be time to post a thread about it.

    On a side note, some of the code in Project H may be out dated due to when Project Baal was released, around about 2012, this will be updated in patches that shall be released. Also, on some of the screenshots features may not be enabled at the time of taking them so it may not show the features you are looking for. If you have any requests for features then feel free to reply to the thread.

    This will also, hopefully, be my final release in the Habbo section - I'll still roam around and post occasionally but that's about it. Once this is released, I'll release patches and updates for it but there will be no more projects from me.

    Current Features
    The list below are features that have been coded and completed. This list will always be kept up to date.

    Green - Completed
    Orange - In progress
    Red - Planned

    Frontpage
    Quick-register
    Hot campaign
    Hot rooms
    News items
    News comments
    Account settings


    • Modify motto
    • Enable friend requests
    • Disable friend requests
    • Change online status
    • Change your trading settings
    • Change who can follow you
    • Change your password
    • Change your email
    • Friend Management

    Habbo Club / VIP
    Community
    Random Habbos
    Staff
    Badge shop
    Client access
    FAQ / Help
    Installation system
    Homes
    Social
    Article likes
    Groups
    Privacy Policy
    Terms of Service
    Contact Us
    Error page
    Habbo Way
    Safety Tips

    Minimail
    Maintenance

    Different Languages

    • Norwegian
    • English
    • Dutch
    • Brazilian
    • Swedish
    • Finnish
    • French
    • German
    • Spanish

    Administration
    • Post a news item
    • Ban a user
    • Submit an issue
    • Check for an update
    • Standalone package


    Note: The Administrative panel will be locked to people rank 6 or above, this can also be user defined - meaning the Hotel owner can choose.

    Updating to the latest theme
    Updating to the latest theme will be done nearer the end of the development process, it will be a completely separate theme (yes, it has a multi-theme selection feature). Pretty much right at the end once most, if not all, features have been completed.

    Credits / Contributors
    TheJacob
    Joopie

    FAQ
    Some questions I have recently been asked, decided to put this here to clear things up with people wondering - and to stop people bugging me.

    Q: When will Project H be released?
    A: Quite a while from now, I estimate probably about a month or two since there are currently still a lot of features missing and I need to document, organise and make sure it is safe to use.

    Q: Will it be completely bug free upon release?
    A: Of course not, you try and find a CMS which is completely bug free. There are thousands of lines of code powering Project H making it what it is. I'll work my ass off trying to make sure the bugs are minimal however.

    Q: What languages will it be available in?
    A: Hopefully about 9 different languages to choose from; ranging from English all the way to Finnish.

    Q: How many different styles will there be available?
    A: As many as the community would like since it's up to them to use their creativity. Upon release there will only be Habbo 2011 style available, I shall be working on the 2014/15 version though.

    Screenshots / Code previews

    Here is 229 lines out of 1204 lines of the template system:

    Code:
        /*     * 
         * Public Function buildFact.
         * 
         * Builds the did you know fact HTML from the database.
         * 
         * @return:     $result     string      Fact HTML.
         * 
         */
        final public function buildFact()
        {
            global $ir;
            
            $result = null;
            
            $query = $ir->db->executeQuery("SELECT f.fact
                                                FROM " . TABLE_PREFIX . "facts f
                                                ORDER BY RAND() ASC;");
            
            if ($ir->db->numRows($query) > 0)
            {
                $result = $ir->db->fetchObject($query)->fact;
            }
            
            return $result;
        }
        
        /*
         * 
         * Public Function buildTopNavigation.
         * 
         * Builds the top navigation HTML from the database.
         * 
         * @return:     $result     string      Top navigation HTML.
         * 
         */
        final public function buildTopNavigation()
        {
            global $ir;
            
            $result = '';
            
            $query = $ir->db->executeQuery("SELECT n.id AS id, n.name AS name, n.url AS url
                                                FROM " . TABLE_PREFIX . "navigation n
                                                WHERE n.type = '1'
                                                    AND n.rank <= '{$ir->habbo->getField('rank', H_USER)}'
                                                ORDER BY n.order_number ASC;");
            
            if ($ir->db->numRows($query) > 0)
            {
                while ($row = $ir->db->fetchObject($query))
                {
                    if ($row->id == THIS_PARENT_ID)
                    {   
                        $result .= '<li class="metab selected">
                                        <strong>' . $row->name . '</strong>
                                        <span></span>
                                    </li>';
                    }
                    elseif ($row->id == 1)
                    {
                        $result .= '<li class="metab">
                                        <a href="' . SITE_URL . $row->url . '">' . $row->name . '</a>
                                        <span></span>
                                    </li>';
                    }
                    else
                    {
                        $result .= '<li>
                                        <a href="' . SITE_URL . $row->url . '">' . $row->name . '</a>
                                        <span></span>
                                    </li>';
                    }
                }
            }
            
            return $result;
        }
        
        /*
         * 
         * Public Function buildSubNavigation.
         * 
         * Builds the sub navigation HTML from the database.
         * 
         * @return:     $result     string      Sub navigation HTML.
         * 
         */
        final public function buildSubNavigation()
        {
            global $ir;
            
            $result = '';
            
            $query = $ir->db->executeQuery("SELECT n.id AS id, n.name AS name, n.url AS url, n.new AS new
                                                FROM " . TABLE_PREFIX . "navigation n
                                                WHERE n.parent_id = '" . THIS_PARENT_ID . "'
                                                    AND n.type = '2'
                                                    AND n.rank <= '{$ir->habbo->getField('rank', H_USER)}'
                                                ORDER BY n.order_number ASC;");
            
            if (($count = $ir->db->numRows($query)) > 0)
            {
                $loopcount = 1;
                
                while ($row = $ir->db->fetchObject($query))
                {
                    if ($row->id == THIS_SUB_ID)
                    {
                        if ($count == $loopcount)
                        {
                            $result .= '<li class="selected last">
                                            ' . $row->name . '
                                        </li>';
                        }
                        else
                        {
                            $result .= '<li class="selected">
                                            ' . $row->name . '
                                        </li>';
                        }
                    }
                    elseif ($count == $loopcount)
                    {
                        $result .= '<li class="last">
                                        <a href="' . SITE_URL . $row->url . '">' . $row->name . '</a>' . (($row->new == 0) ? '' : ' <span style="float: right; color: red; font-size: 8px;">&nbsp; new</span>') . '
                                    </li>';
                    }
                    else
                    {
                        $result .= '<li>
                                        <a href="' . SITE_URL . $row->url . '">' . $row->name . '</a>' . (($row->new == 0) ? '' : ' <span style="float: right; color: red; font-size: 8px;">&nbsp; new</span>') . '
                                    </li>';
                    }
                    
                    $loopcount++;
                }
            }
            
            return $result;
        }
        
        /*
         * 
         * Public Function buildEvents.
         * 
         * Builds the events HTML from the database.
         * 
         * @return:     $result     string      Events HTML.
         * 
         */
        final public function buildEvents()
        {
            global $ir;
            
            $result = '';
            
            $result = '<li class="small" id="feed-hc-reminder">This feature is currently disabled.</li>';
            
            return $result;
        }
        
        /*
         * 
         * Public Function buildImageSelect.
         * 
         * Builds the image select HTML from the database.
         * 
         * @return:     $result     string      Image Select HTML.
         * 
         * @Todo: take out the caching and use the handler object.
         * 
         */
        final public function buildImageSelect()
        {
            global $ir;
            
            $result = '';
            $spath = CWD . '/images/top_stories/';
            $wpath = SITE_URL . '/images/top_stories/';
            
            $result .= '<select name="n.image_url">';
            
            if ($ir->cache->existsCache('ts_Images') == false)
            {
                $folder = opendir($spath);
    
                $pic_types = array('gif', 'png');
    
                $index = array();
    
                while ($file = readdir($folder))
                {
                    if (in_array(substr(strtolower($file), strrpos($file, '.') + 1), $pic_types) == true)
                    {
                        array_push($index, $file);
                    }
                }
    
                closedir($folder);
                
                $ir->cache->addCache('ts_Images', $index, 0);
            }
            else
            {
                $index = $ir->cache->fetchCache('ts_Images');
            }
            
            foreach ($index AS $value)
            {
                $result .= '<option value="' . ($wpath . $value) . '">' . $value . '</option>';
            }
            
            $result .= '</select>';
            
            return $result;
        }
        
        /*
         * 
         * Public Function buildHotCampaigns.
         * 
         * Builds the hot campaigns HTML from the database.
         * 
         * @Param:      $max        int         Maximum number of results to return.
         * 
         * @return:     $result     string      Hot campaigns HTML.
         *       */






    Last edited by NoBrain; 14-03-15 at 08:08 PM.


  2. #2
    TheJacob was here. TheJacob is offline
    MemberRank
    Jun 2010 Join Date
    Toronto, CanadaLocation
    326Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Good luck Ash! Reserved for any future comments I may have about your project -- when the source is available.

  3. #3
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Have another screenshot for the fuck of it.


  4. #4
    PM for free snacks! Hoshiko is offline
    MemberRank
    May 2013 Join Date
    сикаLocation
    282Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    >1024 LoC for the template system only?! Two queries for the menu?! Unneeded iterations?! TheJacob as contributor (as if he could 'help', rofl)?! You really don't give a fuck about performance and user end perception, do you? or maybe this is truly 'a bit of the past', in which case; job well done.
    Last edited by Hoshiko; 24-02-15 at 02:55 PM.

  5. #5
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Quote Originally Posted by Hoshiko View Post
    >1024 LoC for the template system only?! Two queries for the menu?! Unneeded iterations?! TheJacob as contributor (as if he could 'help', rofl)?! You really don't give a fuck about performance and user end perception, do you? or maybe this is truly 'a bit of the past', in which case; job well done.
    1204*

    If I didn't care about the performance why would I be using APC?

  6. #6
    PM for free snacks! Hoshiko is offline
    MemberRank
    May 2013 Join Date
    сикаLocation
    282Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Quote Originally Posted by ησвяαιη View Post
    If I didn't care about the performance why would I be using APC?
    APC is a runtime plugin for PHP. It makes PHP perform more reasonable. It won't speed up any loops nor queries however, getting rid of unnessecary code does.

  7. #7
    Valued Member Tando is offline
    MemberRank
    Mar 2012 Join Date
    NorwayLocation
    108Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Excited to see more. Bring back the "trading is turned on/off" function will you? :)

  8. #8
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Quote Originally Posted by Tando View Post
    Excited to see more. Bring back the "trading is turned on/off" function will you? :)
    Already there bud!


    Last edited by NoBrain; 24-02-15 at 05:42 PM.

  9. #9
    Novice devtemujin is offline
    MemberRank
    Feb 2015 Join Date
    2Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Is there any reason as to why you're conflating database queries with 'template' code?

  10. #10
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Email changing completed.



    Quote Originally Posted by devtemujin View Post
    Is there any reason as to why you're conflating database queries with 'template' code?
    The template files (HTML) are stored within the Database (`prjh_templates`) so they can be modified by the Hotel owner within the Administration panel, it's all cached however.

    - - - Updated - - -

    So, I ended up breaking the Random Habbos feature, took me a while to find the cause. Turns out I'm blind. Here is the current Community page, there is more to be added here.

    Last edited by NoBrain; 24-02-15 at 08:49 PM.

  11. #11
    Project H - A bit of the past! [PHP, MySQLi, APC, WinCache]Project H - A bit of the past! [PHP, MySQLi, APC, WinCache] pel is offline
    MemberRank
    Jan 2012 Join Date
    Munich, GermanyLocation
    384Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    What is APC?
    Are you using a MVC-System?

  12. #12
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Quote Originally Posted by iExit View Post
    What is APC?
    Are you using a MVC-System?
    http://en.wikipedia.org/wiki/List_of...ache_.28APC.29

    It does not use MVC, using an MVC Architecture seems to be the new trend lately. :P

  13. #13
    R.I.P Millercent FatalLulz is offline
    MemberRank
    Nov 2012 Join Date
    AustraliaLocation
    2,248Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Few cool features would be bringing back the ability of the server settings via the HK (For instance if using Phoenix, the credits and pixels timer, amount, MOTD message etc etc). Another thing would be making character settings in client a thing as well :o I miss those (so you can have multiple avatars and all)

  14. #14
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Quote Originally Posted by FatalLulz View Post
    Few cool features would be bringing back the ability of the server settings via the HK (For instance if using Phoenix, the credits and pixels timer, amount, MOTD message etc etc). Another thing would be making character settings in client a thing as well :o I miss those (so you can have multiple avatars and all)
    I have a list of things for the Administration on my desktop which I made today, on top of that I have a new design in my head for the Administration. I shall update the thread with what I can remember off the top of my head. I'll be sure to add those to the list, I'll make sure everything in the `server_settings` table will be editable via the Administration, these particular settings will be for Rank 7+ by default since it's delicate - however the Hotel owner will be able to adjust this to suit their needs.

  15. #15
    R.I.P Millercent FatalLulz is offline
    MemberRank
    Nov 2012 Join Date
    AustraliaLocation
    2,248Posts

    Re: Project H - A bit of the past! [PHP, MySQLi, APC]

    Quote Originally Posted by ησвяαιη View Post
    I have a list of things for the Administration on my desktop which I made today, on top of that I have a new design in my head for the Administration. I shall update the thread with what I can remember off the top of my head. I'll be sure to add those to the list, I'll make sure everything in the `server_settings` table will be editable via the Administration, these particular settings will be for Rank 7+ by default since it's delicate - however the Hotel owner will be able to adjust this to suit their needs.
    Editing what rank has access to what HK page via a page in the HK would also be great!



Page 1 of 14 12345678911 ... LastLast

Advertisement