Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

OldSchool CMS [PHP | OOP | FLATFILE]

Status
Not open for further replies.
Junior Spellweaver
Joined
Jun 8, 2008
Messages
174
Reaction score
24
Hey guys,

I have been away from Habbo and retros for a while, but I have decided that I wanted to get back into the development, mainly the PHP side of it.
Last night I decided that I'd create a fully functional CMS that works with flat file servers such as Debbo. I started this project earlier on today and am doing reasonably well. The main aim is to make the server editable via the website and so that you can keep track of things much easier.

Throughout the development I will keep you all up to date with the progress that has been made and will occasionally post download links to what has been done. For now I will leave snippets of what has been done.

I really miss old school, and wish to try and revive the community!

Catalogue class as it stands:
PHP:
<?php	
	class Catalogue{
	
		private $path = '';
	
		function __construct($path){
			$this->path = $path;
		}
		
		public function getCategories(){
			$list = $this->path.'/database/catalogue/';
			$categories = array();
			foreach (new DirectoryIterator($list) as $file){
				if($file->isDot()) continue;

				if($file->isDir())
				{
					$categories[] .= $file->getFilename();
				}
			}
			return $categories;
		}
		
		public function hasCategory($cate){
			return in_array($cate, $this->getCategories());
		}
		
	}
	
?>

Database class snippets:
PHP:
public function getUsers(){
			$list = $this->path.'/database/habbos/';
			$users = array();
			foreach (new DirectoryIterator($list) as $file){
				if($file->isDot()) continue;

				if($file->isDir())
				{
					$users[] .= $file->getFilename();
				}
			}
			return $users;
		}
		
		public function getCatalogue(){
			return new Catalogue($this->path);
		}
Some user class functions:
PHP:
		function giveBadge(string $badge){
			if(strlen($badge) <= 3){ // check if it's a badge code, normally 3 characters
				$this->badges[] .= $badge; // add badge
				$this->saveChanges(); // update the habbo
			}
			return $this->getBadges(); // we return this, not normally used afterwards though
		}
		
		function setRank($rank){
			$this->rank = $rank;
			$this->saveChanges();
			return $this->getRank();
		}
		
		function saveChanges(){
			$link = $this->path.'/database/habbos/'.$usr.'/'; // get the link to the habbo
			file_put_contents($link.'credits.txt', $this->getCredits()); // Open credits and put the new stuff in
			file_put_contents($link.'hcdays.txt', $this->getHC()); // same with HC
			file_put_contents($link.'rank.txt', $this->getRank()); // same with rank
			file_put_contents($link.'mission.txt', $this->getMission()); // same with mission
			file_put_contents($link.'badges.txt', implode(';',$this->getBadges())); // same with badges, use implode to stick together in same
			//way as the server can read them
		}

Set a certain page to admin only:
PHP:
<?php setRank('admin'); ?>

ACP - User List

Navbar can change if user doesn't have rank

Logged in as TestAccount and trying to access ACP directly

ACP - Cata list
Please note that I am making this to work with Debbo v3.5 flat file and it will come bundled with the final product. No edits to the server have been made.

Current progress:

  • Database - Started
    [*]Catalogue - Started
    [*]ACP - Started
    [*]User registration - Started

    [*]Fetch list of all users - Done
    [*]User login to website - Done
    [*]Fetch list of all Catalogue categories - Done
    [*]Check if user exists - Done
    [*]Save user to files after updating - Done
    [*]Basic user class - Done
    [*]Admin only pages - Done
    [*]ACP user list - Done
    [*]ACP cata list - Done

I am working mostly on the classes at the moment to try and build a strong and secure structure.

Thanks for the interest!
eMagic
 
Last edited:

pel

Skilled Illusionist
Joined
Jan 27, 2012
Messages
382
Reaction score
343
I cant imagine the style.. can you post some screenshots (if you have some)? :D codes looks.. yea okay.. but why no MVC System?
 
Junior Spellweaver
Joined
Jun 8, 2008
Messages
174
Reaction score
24
I cant imagine the style.. can you post some screenshots (if you have some)? :D codes looks.. yea okay.. but why no MVC System?

The style at the moment us just a Habbo Fansite style from HabboEmotion. I didn't know what to use to be honest and didn't want to make a whole template from scratch. Admittedly the style is horrible and I will have changed it by the end of Development, if I have the time and really feel like this will be of benefit to the community then I will code in a template system as well like RevCMS.

- not logged in
- logged in as StrayPixel
- showing the user in flatfile db

In regards to the MVC, I haven't looked at this, but it could be an idea :p

~eMagic
 
Elite Diviner
Joined
Apr 5, 2014
Messages
464
Reaction score
223
Personally I would love to see this type of layout

eMagic - OldSchool CMS [PHP | OOP | FLATFILE] - RaGEZONE Forums
 
Junior Spellweaver
Joined
Jun 8, 2008
Messages
174
Reaction score
24
Personally I would love to see this type of layout

eMagic - OldSchool CMS [PHP | OOP | FLATFILE] - RaGEZONE Forums

Awesome idea, I love this layout too!

By the end of the development this will be the design that it all fits in with!

Thanks for that, I completely forgot about this design, I used it on a previous old school I had made.
 
Custom Title Activated
Loyal Member
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
Why flatfile? I think Woodpecker (it's SQL) is much better, or maybe even Thor. Nevertheless, it's looking good. BUT:

PHP:
        function giveBadge(string $badge){
            if(strlen($badge) <= 3){ // check if it's a badge code, normally 3 characters
                $this->badges[] .= $badge; // add badge
                $this->saveChanges(); // update the habbo
            }
            return $this->getBadges(); // we return this, not normally used afterwards though
        }

I don't get this. First, last time I made an oldskool hotel (not my dev hotel), I had badges with names longer than 3 characters. Think of the Achievement badges. YES, maybe nobody uses them, but if somebody wants, they can't. Also, WHY do you even return the badges. It's useless because you don't use it at al. Still, good luck.
 
Junior Spellweaver
Joined
Jun 8, 2008
Messages
174
Reaction score
24
Look at EvilCMS, it can help you ;)

That's where the idea for this came from, I used to use EvilCMS, I just wanted to do something which had a few more functionalities, and also update it by using OOP :) Thanks though!

Why flatfile? I think Woodpecker (it's SQL) is much better, or maybe even Thor. Nevertheless, it's looking good. BUT:

PHP:
        function giveBadge(string $badge){
            if(strlen($badge) <= 3){ // check if it's a badge code, normally 3 characters
                $this->badges[] .= $badge; // add badge
                $this->saveChanges(); // update the habbo
            }
            return $this->getBadges(); // we return this, not normally used afterwards though
        }

I don't get this. First, last time I made an oldskool hotel (not my dev hotel), I had badges with names longer than 3 characters. Think of the Achievement badges. YES, maybe nobody uses them, but if somebody wants, they can't. Also, WHY do you even return the badges. It's useless because you don't use it at al. Still, good luck.

Yes, but they were introduced after Old school so I wasn't thinking anybody'd use them on an old school server, I could change it to four if people needed, but it's a simple edit that anyone could do.
I return badges so that if someone was adding a base you could use the code:

PHP:
if(in_array($_POST['badge'], $user->giveBadge($_POST['badge'])){
    echo('User now has the badge');
}else{
    echo('An error occured');
}
I know it's needless but somebody might find it handy when adding a feature or two, if you don't like it it could be removed :p

Also, I'm working on a CMS for Debbo v4, the reason why it doesn't have a dev thread is because it probably wont get released. Debbo v4 uses MySQL. This is the current style it uses: same as ZabboWeb.

~eMagic
 
Last edited:
Junior Spellweaver
Joined
May 21, 2011
Messages
154
Reaction score
47
Why flatfile? I think Woodpecker (it's SQL) is much better, or maybe even Thor. Nevertheless, it's looking good. BUT:

PHP:
        function giveBadge(string $badge){
            if(strlen($badge) <= 3){ // check if it's a badge code, normally 3 characters
                $this->badges[] .= $badge; // add badge
                $this->saveChanges(); // update the habbo
            }
            return $this->getBadges(); // we return this, not normally used afterwards though
        }

I don't get this. First, last time I made an oldskool hotel (not my dev hotel), I had badges with names longer than 3 characters. Think of the Achievement badges. YES, maybe nobody uses them, but if somebody wants, they can't. Also, WHY do you even return the badges. It's useless because you don't use it at al. Still, good luck.

I agree with Josh, the methode still called 'giveBadge' so returning anything is just useless. Why would you save everything (saveChanges) for just one edit, but good luck with your development!
 
Junior Spellweaver
Joined
Jun 8, 2008
Messages
174
Reaction score
24
I agree with Josh, the methode still called 'giveBadge' so returning anything is just useless. Why would you save everything (saveChanges) for just one edit, but good luck with your development!

Thanks for the feedback, it was because saveChanges was wrote quickly, I'll probably make that the only public method and separate private saveBadges etc...

And as I mentioned above, it could be useful, if the badge length is wrong, etc...

~eMagic
 
Junior Spellweaver
Joined
May 21, 2011
Messages
154
Reaction score
47
Thanks for the feedback, it was because saveChanges was wrote quickly, I'll probably make that the only public method and separate private saveBadges etc...

And as I mentioned above, it could be useful, if the badge length is wrong, etc...

~eMagic

I understand what you mean, but it's still weird. Maybe it's a better idea to create a methode called 'hasBadge(badgeId)' or return a boolean in 'giveBadge'. Successful -> true, else false.

Btw, don't forget to make a check whether the user already has that badge.
 
Junior Spellweaver
Joined
Jun 8, 2008
Messages
174
Reaction score
24
I understand what you mean, but it's still weird. Maybe it's a better idea to create a methode called 'hasBadge(badgeId)' or return a boolean in 'giveBadge'. Successful -> true, else false.

Btw, don't forget to make a check whether the user already has that badge.

Will do :p Thanks for the suggestion, I thought about that when I was going back over the code after you bad said it XD

~eMagic
 
Experienced Elementalist
Joined
May 30, 2013
Messages
288
Reaction score
242
Make a node.js application that reads a USA111-compatible backend, caches frequent accessed data, saves data at regular interval and exposes it through a HTTP RESTful interface, then query that as a API.

Then you won't have to worry about nasty and unsafe fopen calls anymore. :)!
 
Status
Not open for further replies.
Back
Top