Mysidia Adoptables v1.3.2[Security Release]

Forum
Last Post
Threads / Messages
Status
Not open for further replies.

Hall of Famer

Administrator
Staff member
Administrator
Joined
Dec 15, 2008
Messages
4,564
Points
48
Location
United States
Mysidian Dollar
214,223
Well guess the development for Mys v1.3.2 has been taking longer than expected, I almost put it off for like half a year. The good news is that the new version is finally ready to be released. Happy Turkeys day everyone, and now allow me to introduce the changes and new features in Mys v1.3.2:

1. Improvement of Object Oriented Design: If Mys v1.3.1 was our first step towards OOP, Mys v1.3.2 sure pushed this forward quite a bit. In this version several core mysidia classes are created, they will prove quite useful for us in not so distant future. Mys v1.3.2 introduces 50+ new classes, and old classes are revised to improve performance. The ACP brings up the concept of controller, which you will see a lot in Mys v1.3.3.

2. New AdminCP Layout and functionality: Well this isnt the grand ACP overhaul project I was talking about for Mys v1.4.0, but its a rather important step to achieve the goal. I already posted the new ACP layout in a blog entry, I like the way it looks thanks to Nyxi's awesome work. The ACP menu items expand/collapse using javascript, something you may find intriguing once you get used to how it works.

3. Adoptables Shop System: It is now possible to buy adoptables from various shops in the marketplace! The shop works in a similar way as itemshop, in which admins can specify whether the shop is open and how much tax to charge. The adoption center now only shows pets not purchasable from adoptables shop. This was supposed to be the main new feature for Mys v1.3.2, though it didnt take me much time to complete.

4. Protected Custom Pages:
If you have paid attention to a recent blog I posted, you'd figure out that the content management system has received a major improvement. In additional to the usage of CKEditor, admins can even specify protected pages with the following conditions: promocode, item, time and usergroup. The four aint mutually exclusive, so it is up for you to build an highly protected page for authorized users only.

5. MyBB Forum Integration Basics: It's been quite a long time since we first supported MyBB forum integration. In Mys v1.3.1 there was a problem that forum stats could not rebuild, which led to messed up forum stats. This has been fixed in Mys v1.3.2, and at this point all basics of MyBB bridge are completed. Future updates will probably bring up advanced features such as user sync and forum posts/activity in user profile tab.

6. Old glitches fixed in new release: umm this happens in every release, doesnt it? One major issue was the font size glitch with pagination, this has been resolved in Mys v1.3.2. The promocode now supports both public and private promocodes equally well. Adoptables hard deletion is also working as it should be. Anyway Mys v1.3.1 fixed most glitches in the original release, so there probably aint many noticeable ones this time.

Installation Guide:
1. Use ftp to Upload the entire folder Mysidia Adoptables v1.3.2 to your preferred directory, and change the name to whatever you like.
2. Change the CMD of folder "picuploads" to 777, together with its subfolders, this is required to enable user uploading images.
3. Rename the file config_adopts to config.php, otherwise the script will tell you config.php does not exist.
4. Access the installer script at "http://yoursitename.com/install/index.php", follow the instructions and proceed.
5. Congrats, you've successfully installed Mys v1.3.2. There is no need to manually encrypt your password in Mys v1.3.2, so cheers!

Note: The value pepper code can be generated from a website called: http://strongpasswordgenerator.com/, it can be of any length and may contain symbols. Make sure to delete the file install/index.php after running this script, or your site is potentially at danger if this file is accessed by someone else.

Upgrade Mini-Guide:
An upgrader from mys v1.3.1 is available, but the megaupgrader from Mys v1.2.x will have to wait till probably in my winter break. To upgrade, simply upload all script files to your folder and overwrite the existing ones. The config file is named config_adopts.php by default, so your old config file should be safe. Now run the upgrade.php script to complete this task, shouldnt take more than 10 secs. Note you need to manually remove the file lang.php from your /inc directory before proceeding, and the upgrade.php file too after you have completed this process.

Do not use the upgrader if you have a site with heavily modified script! Unlike Mys v1.3.1, Mys v1.3.2's changes are way too dramatic. If you have modified any script files before, or added your own piece of code, your site will surely not function at all. Even old Mods/Addons for Mys v1.3.1 do not work on this version, for this reason I will update my 'Gender Ratio' Mod a few hours later to be compatible with this version. Of course if you are intermediate or advanced programmer, you should be fine making changes on your own to get it to work somehow.


Forum Integration Guide:

First of all, make sure you have both fresh installation of Mysidia Adoptables and MyBB forum. Open the file /inc/config_forums.php, enter each empty field for the database info of your MyBB forum. Then Change the variable mybbenabled from 0 to 1. The very last step is to disable registration on the forum. It is all said and done, new users will have accounts created from both the adoptables site and the forum from now on. In Mys v1.3.2 they also log into site and forum accounts simultaneously! The forum stats is automatically updated whenever a new registration is completed, so there is no need for admins to update forum stats in ACP from now on.

Download Links(both .rar and .zip are provided):

Rapidshare links:

Rar version:
https://rapidshare.com/files/2866623410/Mysidia Adoptables v1.3.2.rar

Zip version:
https://rapidshare.com/files/1617330747/Mysidia Adoptables v1.3.2.zip

Mediafire Links:

Rar version:
http://www.mediafire.com/?xk38s8mocccvnw4

Zip version:
http://www.mediafire.com/?9zpf0xvaxs2d76h

The fact is that, well, Mys v1.3.2 is a dramatic change from Mys v1.3.1. It comes with a few new features, but these features alone should not have taken more than 2 months for me. The real challenge was with the improvement of script quality. I am trying to establish an organized coding style and structure for this script. Some programmers refer to this as framework, though at this point this script still does not really have a complete framework yet.

Starting from Mys v1.3.2 we are making a huge step in the transition from procedural PHP to object oriented PHP. The new code will probably give a headache to some of you, especially if you are so used to traditional php programming. This cannot be helped, its the way of future. The only thing I am sure is that once the transition is complete, development of Mysidia adoptables script will be moving forward in a different level. Much faster and much less redundant work.

I thank you everyone who stick to us and this project for this long without a stable release being made. The next version should not take more than one and a half month though, the transition from Mys v1.3.1 to v1.3.2 really was one of the hardest since we had to find a direction where this script should go.

Hall of Famer
November 22, 2012
 
Yes! Yes! Yes! Downloading this right away! Finally decided that, since I love drawing them so much, I'm going to go ahead and make a Pine Marten site :D Can't wait to get working on my site!

You have no idea how grateful and happy I am for this script!

EDIT:
Okay, just finished installing the script and all went well...but when I tried to access my site, I got this:
Fatal error: Can't inherit abstract function Creator::create() (previously declared abstract in UserCreator) in /home/u526740665/public_html/classes/abstract/abstract_usercreator.php on line 3
 
Last edited:
umm weird, never happened to me before, are you trying to upgrade from an old site? Can you show me the two script files abstract_usercreator.php and class_membercreator.php? It looks to me that the script is trying to inherit the same method twice.
 
Okay, here's the abstract_usercreator.php:
PHP:
<?php

abstract class UserCreator implements Creator{
  // The abstract factory class UserCreator
  
  abstract public function create();
  abstract public function massproduce();
  
  public static function logincheck(){
     global $mysidia;
	
	 //Check for cookie
	 if(!$mysidia->cookies->getcookies("mysuid") or !$mysidia->cookies->getcookies("myssession")) return FALSE;
	 else{
        $uid = secure($mysidia->cookies->getcookies("mysuid"));
		$session = secure($mysidia->cookies->getcookies("myssession"));

		//Run login operation
        $luser = $mysidia->db->select("users", array("uid", "session"), "uid = '{$uid}'")->fetchObject();
		$luid=$luser->uid;
		$lsess=$luser->session;
        
		if($uid == $luid and $session == $lsess) return TRUE;
		else{
			if(isset($_COOKIE['mysuid'])) setcookie("mysuid", $uid, time() - 10);
			if(isset($_COOKIE['myssession'])) setcookie("myssession", $session, time() - 10);
			return FALSE;
		}
     }
     // End of login check
  }
  
  protected function getusergroup($userinfo){
     global $mysidia;
	 $whereclause = (is_numeric($userinfo))?"uid ='{$userinfo}'":"username ='{$userinfo}'";
     $usergroup = $mysidia->db->select("users", array("usergroup"), $whereclause)->fetchColumn();
	 if(empty($usergroup)) throw new Exception('Invalid Usergroup, cannot instantiate user object');
	 return $usergroup;
  }
  
  protected function getgroupcategory(){
     global $mysidia;
     $category = $mysidia->db->select("groups", array("category"), "uid ='{$uid}'")->fetchColumn();
     if(empty($category)) throw new Exception('Invalid Usergroup Category, cannot instantiate user object');
     return $category;	 
  }
  
  protected function getidentity(){
     $spiderip = array();
	 if(in_array($_SERVER['REMOTE_ADDR'], $spiderip)) $identity = "Spider";
	 else $identity = "Guest";
	 return $identity;
  }
  
}
?>

And here's the class_membercreator.php:
PHP:
<?php

class MemberCreator extends UserCreator{
  // The abstract factory class UserCreator
  protected $userinfo;
  protected $usergroup;
  protected $user;
   
  public function __construct($userinfo){
     if(empty($userinfo)) throw new Exception('User id or Username does not exist...');
     $this->userinfo = $userinfo;
	 $this->usergroup = $this->getgroupid();
  }

  public function getgroupid(){
     global $mysidia;
     $whereclause = $whereclause = (is_numeric($this->userinfo))?"uid ='{$this->userinfo}'":"username ='{$this->userinfo}'";
     $gid = $mysidia->db->select("users", array("usergroup"), $whereclause)->fetchColumn();
     return $gid;
  }

  public function getgroupcategory(){
     // This feature will be fully implemented in Mys v1.3.3 or v1.3.4.
     if($this->usergroup == 1 or $this->usergroup == 2) return "Admin";
     elseif($this->usergroup == 4 or $this->usergroup == 6) return "Mod";
     elseif($this->usergroup == 3) return "Registered";
     elseif($this->usergroup == 5) return "Banned";
     else throw new Exception('Cannot recognize usergroup category for this user, he/she may be a guest, a bot, or else...');
  }

  public function create(){
     $category = $this->getgroupcategory();
     switch($category){
        case "Admin":
		   $this->user = $this->create_admin();
		   break;
		case "Mod":
           $this->user = $this->create_mod();
           break;
        case "Banned":
           $this->user = $this->create_banned();
		   break;		   
        default:
		   $this->user = $this->create_member();           		
     }
     return $this->user;	 
  }
  
  public function massproduce(){
     return FALSE;
  }
    
  private function create_admin(){
     return new Admin($this->userinfo);
  }
  
  private function create_mod(){
     return new Mod($this->userinfo);
  }
  
  private function create_member(){
     return new Member($this->userinfo);
  }
  
  private function create_banned(){
     return new Banned($this->userinfo);
  }
}
?>

(Sometimes I feel like it's just my job to find as many errors as possible...most of them being my fault for some reason XD)
 
Well its perfectly fine, lol. An compile-time error like this should have been detected and fixed by me way before the official release if I can find it. Mvm...

I dont see anything wrong with the script, lets give this a try though. For the UserCreator class, find the first line::

PHP:
abstract class UserCreator implements Creator{

remove the implements Creator parts so it becomes:

PHP:
abstract class UserCreator{

See if it works. If not, post your class_visitorcreator.php too and I'd like to do a thorough search on what may be causing the error.
 
is htere also coming a tutorial coming for imlementing own scripts? (i.e. modifications), as i heard somewhere on this board that there are some changes in the variables~ (and i don't know what to change right now in my modifications):catfish:
 
Well yeah, I will post a short tutorial on how to do this. In fact, its pretty simple.

And btw, do you encounter the 'cannot inherit abstract method' error Iris was getting? It never occurred on my server, but an error of this magnitude should be noticeable to me long before the script was completed. Weird.
 
Okay, edited as you said to, and got this error:
Fatal error: Call to undefined method DateTime::getTimestamp() in /home/u526740665/public_html/classes/class_visitor.php on line 15

And here's my class_visitor.php:
PHP:
<?php

class Visitor extends User{
  public $isloggedin;
  public $error;
  
  public function __construct($uid){
	  // Fetch the basic member properties for users
	  
      $this->uid = 0;
	  $this->ip = $_SERVER['REMOTE_ADDR'];
	  $this->usergroup = Usergroup::fetchgroup('Visitor');
	  
	  $time = new DateTime();
      $this->lastactivity = $time->getTimestamp();
      $this->isloggedin = UserCreator::logincheck();	  
  }
  
  public function __call($method, $param){
      // This magic method triggers when visitors attempt to visit pages inaccessible to guests
	  
	  $this->error = "The functionality is unavailable for guests, please log in or register.";
	  return FALSE;
  }
  
  public function __get($param){
      // This magic method triggers when visitors attempt to visit pages inaccessible to guests
	  
	  $param = 0;
	  return $param;
  }
  
  public function register(){
      // Will be added in future
	  global $mysidia;
	  $date = new DateTime;
	  $salt = codegen(15);
	  $password = passencr($mysidia->input->post("username"), $mysidia->input->post("pass1"), $salt);
	  // Insert the very first row of data for user registration
      $mysidia->db->insert("users", array("uid" => NULL, "username" => $mysidia->input->post("username"), "salt" => $salt, "password" => $password, "session" => NULL, "email" => $mysidia->input->post("email"), "ip" => $_SERVER['REMOTE_ADDR'], 
			                         "usergroup" => 3, "birthday" => $mysidia->input->post("birthday"), "membersince" => $date->format('Y-m-d'), "money" => $mysidia->settings->startmoney, "friends" => NULL));
	  $uid = $mysidia->db->select("users", array("uid"), "username = '{$mysidia->input->post("username")}'")->fetchColumn();
	  
	  // Now update the session
	  $myssession = md5($uid.$mysidia->session->getid());
	  $mysidia->db->update("users", array("session" => $myssession), "uid = '{$uid}'");	

      // Insert user data to the other tables
	  $mysidia->db->insert("users_contacts", array("uid" => $uid, "username" => $mysidia->input->post("username"), "website" => NULL, "facebook" => NULL, "twitter" => NULL, 
	                                           "aim" => NULL, "yahoo" => NULL, "msn" => NULL, "skype" => NULL));
	
	  $mysidia->db->insert("users_options", array("uid" => $uid, "username" => $mysidia->input->post("username"), "newmessagenotify" => 1, "pmstatus" => 0, 
	                                          "vmstatus" => 0, "tradestatus" => 0, "theme" => $mysidia->settings->theme));

      $mysidia->db->insert("users_profile", array("uid" => $uid, "username" => $mysidia->input->post("username"), "avatar" => $mysidia->input->post("avatar"), "bio" => $mysidia->input->post("bio"), "color" => $mysidia->input->post("color"), 
	                                          "about" => NULL, "favpet" => 0, "gender" => $mysidia->input->post("gender"), "nickname" => $mysidia->input->post("nickname")));											  
	
	  $mysidia->db->insert("users_status", array("uid" => $uid, "username" => $mysidia->input->post("username"), "canlevel" => 'yes', "canvm" => 'yes', "canfriend" => 'yes', 
	                                         "cantrade" => 'yes', "canbreed" => 'yes', "canpound" => 'yes', "canshop" => 'yes'));
    
      $mysidia->page->settitle($mysidia->lang->success_title);
      $mysidia->page->addcontent($mysidia->lang->success.$mysidia->input->post("username").$mysidia->lang->success2);	  
  }
  
  public function login($username){
      global $mysidia;
	  if($this->ip != $mysidia->session->clientip) throw new Exception('Your IP has changed since last session, please log in again.');
	  else{	     
	     $mysidia->cookies->setcookies($username);
	     $mysidia->db->update("users", array("session" => $mysidia->cookies->getcookies("myssession")), "username = '{$username}'");		 
		 include("inc/config_forums.php");
         if($mybbenabled == 1){
            include_once("functions/functions_forums.php");   
            mybblogin();
         }
         return TRUE;
	  }	 
  }
  
  public function getloginform(){
      $loginform = "<form name='form1' method='post' action='login.php'>
                    <p>Username: <input name='username' type='text' id='username'></p>
                    <p>Password: <input name='password' type='password' id='password'></p>
                    <p><input type='submit' name='Submit' value='Submit'></p>
                    <p>Don't have an account?<br>
                    <a href='register.php'>Register Free</a>  </p>
                    <a href='forgotpass.php'>Forgot your password?  Click Here</a>
                    </form>";
      return $loginform;	
  }
  
  public function logout(){
      global $mysidia;
      $mysidia->page->settitle("Already logged out");
	  $mysidia->page->addcontent("It appears that you are already logged out from this site...", TRUE);
	  return FALSE;
  }
  
  public function resetpass($username, $email){
      global $mysidia;
      $newpw = codegen(12);
      $newsalt = codegen(15,0);
      $newpass = passencr($username, $newpw, $newsalt);

      //Update the database with the new password...
      $mysidia->db->update("users", array("password" => $newpass, "salt" => $newsalt), "username='{$username}' and email='{$email}'");

      //Delete the entry from the password reset table
      $mysidia->db->delete("passwordresets", "code='{$mysidia->input->post("code")}'");
      return $newpw;	  
  }
}
?>
 
Well are you running PHP 5.2? This looks like a problem that should not have existed in the first place, your PHP version does not support advanced DateTime Object manipulation. Or it may have been misconfigured?

I can look up the files and use alternative approaches for you at this point so that you can bypass the DateTime functions missing error. But keep in mind that DateTime is a common class in PHP 5.3.x development, if you are indeed running PHP 5.2.x then its probably time to upgrade or switch host. I try to compromise for those using PHP 5.2.x for Mys v1.3.x releases, but in Mys v1.4.0 and onwards supports for older versions of PHP will be dropped.
 
i currently am a little too lazy to test it out, so don't expect me upgrading my site soon or reporting bugs..~ ^^;
 
I'll try to find out what version of PHP 99webs.info is using...since that's the host I am using for it.

Do you know, off the top of your head, what version 000webhost.com is using? They just say PHP 5, nothing more specific.

EDIT: 000webhost is running 5.2 as well. Do you know of any hosts that are running 5.3..? I'll try to find a free host that does support it...hm...

EDIT 2: Nevermind, I finally found a host that allows more than one database and also is running PHP 5.3.1, I guess I'll just be moving my site over to this host.
 
Last edited:
Well many shared hosts such as hostgator and bluehost actually provide PHP 5.3 as alternative, you have to add an additional config file to PHP's directory. For 000webhost and x10hosting probably not, these are freehosts, not shared host.
 
Well, I've contacted 99webs.info about it, and they (Nemesis, I presume) said they'll look into getting it updated...hope so because the host I found does not allow Java, of all the things.
 
I see, best of luck on that Iris. If the worst came to worst and this problem remains unresolved by the time I finish my last final exam, I will try to re-design the script so that it has backward compatibility with PHP 5.2.
 
Update: The error Iris was getting early on turns out to be a PHP bug, not with this script. It affects PHP version 5.2 and early versions of 5.3, you need PHP 5.3.9 or newer to be able to use it properly. But if you do happen to use older version, do not worry, look at the first page and I've offered a solution to get through this error.
https://bugs.php.net/bug.php?id=43200
 
WOOT!!! I've been quiet and have done nothing for my site as I'm now currently returned to college and classes are taking ALL my time, that and running a guild in Everquest 2, but my dream to run my own pet site someday will happen. Thank you for your hard work and for making a script for us non/ankle deep programmers. I will upload this when I get a chance and play around with it. I probably won't do any serious work in my site until a much later version that is fully OOP as each change lately is so massive it generally requires a full installation.

Will there eventually be a premium version of this project that will require a purchase? I would definitely consider buying a premium version when this is in it's final form.
 
Thanks for your comment Kesstryl. The script is likely to be mostly object oriented by version 1.4.0, I have no idea when it will be released though. The entire lifecycle of Mys v1.3.x will pave way for this transition, eventually an ORM-MVC framework will be constructed successfully for this product. It may take version v1.5.0 to make a fully object oriented truly professional script.

I am not sure for a premium version of this script, for the entire Mys v1.3.x and v1.4.x series it will remain as free product. If someday I feel like it, I may end up running hosting services for Mysidia Adoptables in which you can build a free default site with some features only available through purchasing. It will be like a much more upgraded version of MA, although you pretty much dont see much difference between Mysidia Adoptables and MyAdopts already. Not sure if this will happen though, but I dont rule out such a possibility.
 
As an update to my problem:

The other host I found isn't go to work out...nor is another I found. Both refused to return any questions I had, and just didn't work out at all. Luckilly, however, I have been assured that 99webs.info will be updating to a newer version of PHP :) Hopefully I can actually get my site up and running soon...switched from Pine Martens to Hamsters, since hamsters are pure love (though I hate those ugly little tails...they're still pretty cute).

Until then I'll just work on art...finally figured out how to shade realistically!
 
Okie dokie. Everything so far is going pretty well but I have a question about forum integration. Our forum and adopts have been separate (not integrated) for months now. The integration seems easy enough but I'm worried for my members. What will happen to the accounts that are preexisting or that only have an account on one half of the site?
 
These old accounts will not be integrated most likely, but there is a chance they will assuming the user Ids from adoptables and forum database match rach other. It won't hurt to try, in future I will create a user synchronization script that does the trick to you.
 
Status
Not open for further replies.

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top