Strange slashes appearing in site text?

Forum
Last Post
Threads / Messages

Hwona

Member
Member
Joined
Mar 1, 2013
Messages
620
Points
0
Mysidian Dollar
31,589
Hi! Has anyone else noticed these strange slashes wherever you add a apostrophe? For example:
it's
turns into:
it'/s

Does anyone know how to fix this? :3
 
It's something happening in the database settings I think, when it won't accept them. It really 'bugs', haha.

Would be neat to have them go away :)
 
@Annatar
I suspect it might have something to do with... collition? Something like that... o_O
 
Maybe....? I just use its instead of it's, etc, but it would be great to be able to use correct grammar and have it take it ..

Right now this other item bug is just about to shut down my site, it's a pretty major thing.
 
@Annatar
Well, you can change the collation to hp8_english_ci, but I'm too scared to test whether or not this will fix the problem... :L
 
Well inside your database it's supposed to have slashes, this is done by the script to filter SQL injection or related hacks. In theory the slashes are stripped after you load it from database, but for some reason it aint happening. I think the fix should be easy, just need to find out which script/url you see these slashes on.
 
Umm I got this:

Access Denied


Only members may access this page. Please log in or register to access this page.

But I think I have an idea now, post your view/shopview.php and I will see if I can edit some lines there to fix this issue for you.
 
@HoF
Oh, sorry about that! - And I'm using v.1.3.3, so there's no shop view... should I post the class files instead? :3
 
umm with version 1.3.3 it can be a bit tricky. Post shop.php and class_shop.php and I will see if I can fix it for you. The code may be in other class files too, but lets try the most likely scripts first.
 
Shop.php:
PHP:
<?php

class ShopController extends AppController{

    const PARAM = "shop";
    private $view;
	private $subController;

    public function __construct(){
        parent::__construct("member");	
        $mysidia = Registry::get("mysidia");		
        $mysidia->user->getstatus();
		if($mysidia->user->status->canshop == "no"){
		    throw new NoPermissionException($mysidia->lang->denied);
		}
		if($mysidia->input->action() != "index" and !$mysidia->input->get("shop")){
		    throw new InvalidIDException($mysidia->lang->global_id);
		}
    }
	
	public function index(){
	    $mysidia = Registry::get("mysidia");
		$document = $mysidia->frame->getDocument();
	    $document->setTitle($mysidia->lang->access);
		
		$typeForm = new Form("shoptypes", "shop", "post");
		$typeSelection = new DropdownList("shoptype");
		$typeSelection->add(new Option("Itemshop", "itemshop"));
		$typeSelection->add(new Option("Adoptshop", "adoptshop"));
		$typeForm->add($typeSelection);
		$typeForm->add(new Button("Go", "submit", "submit"));
		$document->add($typeForm);
 
        $shoplist = new Shoplist($mysidia->input->post("shoptype"));
        $shoplist->display();
	}
	
	public function browse(){
		$mysidia = Registry::get("mysidia");
		$document = $mysidia->frame->getDocument();			        
		$document->setTitle($mysidia->lang->welcome);
		
		$shoptype = $mysidia->db->select("shops", array("shoptype"), "shopname = '{$mysidia->input->get("shop")}'")->fetchColumn();
        $shoplist = new Shoplist($shoptype);
        $shop = $shoplist->createshop($mysidia->input->get("shop"));
        $shop->display();
	}
	
	public function purchase(){
        $mysidia = Registry::get("mysidia");
		$document = $mysidia->frame->getDocument();
	    if(!$mysidia->input->post("buy")) throw new InvalidIDException($mysidia->lang->global_id);
		
	    if($mysidia->input->post("shoptype") == "itemshop"){
		    $shop = new Itemshop($mysidia->input->get("shop"));
            $item = $shop->getitem($mysidia->input->post("itemname"));
			$item->assign($mysidia->user->username);
            $oldquantity = $item->getoldquantity();
            $newquantity = $oldquantity + $mysidia->input->post("quantity");
			
			if(!is_numeric($mysidia->input->post("quantity"))){
			    throw new InvalidActionException($mysidia->lang->invalid_quantity);
            }
            elseif($newquantity > $item->cap){
			    throw new InvalidActionException($mysidia->lang->full_quantity); 
            }
            else{
			    $shop->purchase($item);
				$document->setTitle($mysidia->lang->global_transaction_complete);
	            $document->addLangvar("{$mysidia->lang->purchase_item}{$item->getcost($shop->salestax)} {$mysidia->settings->cost} and {$item->getcost2($shop->salestax)} {$mysidia->settings->cost2}.");
            }
		}
		elseif($mysidia->input->post("shoptype") == "adoptshop"){
		$adoptobedience = rand(0,100);
		    $shop = new Adoptshop($mysidia->input->get("shop"));
            $adopt = $shop->getadopt($mysidia->input->post("adopttype"));
            $adopt->assign($mysidia->user->username);
            $shop->purchase($adopt);
            $num = 1;
            $adoptid = $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY aid DESC LIMIT 1")->fetchColumn() - $num + 1;
             $personalities = array('Shy', 'Friendly', 'Loyal', 'Bold', 'Courageous', 'Witty', 'Agressive', 'Docile', 'Mischievious', 'Serious', 'Quirky', 'Playful', 'Lazy');
		   shuffle($personalities);
foreach ($personalities as $personality) {
    $adoptablepersonality = "$personality";
}
            $adoptobedience = rand(0, 100);
                $adoptintellect = rand(0,100);
		    $adoptspeed = rand(0,100);
		    $adoptstrength = rand(0,100); 
            $mysidia->db->update("owned_adoptables",array("obedience" => $adoptobedience, "personality" => $adoptablepersonality, "intellect" => $adoptintellect, "speed" => $adoptspeed, "strength" => $adoptstrength),"aid = $adoptid");
   			$document->setTitle($mysidia->lang->global_transaction_complete);
	        $document->addLangvar("{$mysidia->lang->purchase_adopt}{$adopt->getcost($shop->salestax)} {$mysidia->settings->cost} and {$adopt->getcost2($shop->salestax)} {$mysidia->settings->cost2}.");	  
		}
		else throw new InvalidActionException($mysidia->lang->global_action);
	}
}
?>

class_adoptshop:
PHP:
<?php

class Adoptshop extends AdoptContainer{
  public $sid;
  public $category;
  public $shopname;
  public $shoptype;
  public $description;
  public $imageurl;
  public $status;
  public $restriction;
  public $salestax;
  public $adopts;
  protected $total = 0;
  
  public function __construct($shopname){
      // Fetch the database info into object property
	  
	  $mysidia = Registry::get("mysidia");
	  $row = $mysidia->db->select("shops", array(), "shopname ='{$shopname}'")->fetchObject();
	  if(!is_object($row)) throw new Exception("Invalid Shopname specified");
	  
	  // loop through the anonymous object created to assign properties
      foreach($row as $key => $val){
         $this->$key = $val;		 
      }

      $this->adopts = $this->getadopttypes();
	  $this->total = (is_array($this->adopts))?count($this->adopts):0;
  }

  public function getcategory(){
      // This method checks if the shop category exists in adoptables database or not
	  
	  $mysidia = Registry::get("mysidia");
	  $stmt = $mysidia->db->select("shops", array(), "category ='{$this->category}'");
      $cate_exist = ($row = $stmt->fetchObject())?TRUE:FALSE;     
	  return $cate_exist;
  }
  
  public function getshop(){
      // This method check if a shop exists in database or not
	  
	  $mysidia = Registry::get("mysidia");
	  if(empty($this->shopname)) $shop_exist = FALSE;
	  else{
	     $stmt = $mysidia->db->select("shops", array(), "shopname ='{$this->shopname}'");
		 $shop_exist = ($row = $stmt->fetchObject())?TRUE:FALSE;    
	  }
	  return $shop_exist;
  }
  
  public function getadopttypes(){
  	 if(!$this->adopts){
	    // The iids have yet to be loaded, lets acquire their info from database
		$mysidia = Registry::get("mysidia");
		
		$stmt = $mysidia->db->join("adoptables_conditions", "adoptables_conditions.id = adoptables.id")
				            ->select("adoptables", array(), constant("PREFIX")."adoptables.shop ='{$this->shopname}'");	
		$adopts = array();
		while($adopt = $stmt->fetchObject()){
		   $aid = $row->id;
		   $promocode = "";
		   if(canadopt($aid, "showing", $promocode, $row)) $adopts[] = $adopt;
		}
		return $adopts;
	 }
	 else return $this->adopts;
  }
  
  public function gettotal(){
      // This method returns the total number of adoptables available	  
	  return $this->total;
  }
  
  public function display(){
      // This method displays the shoplist to users. It may look messy at this moment, but not after we create a table class	
	  $mysidia = Registry::get("mysidia");	  
	  $document = $mysidia->frame->getDocument();			  
	  $document->addLangvar($mysidia->lang->select_adopt);
      if($this->gettotal() == 0){
         $document->addLangvar($mysidia->lang->empty);
		 return FALSE;
      }	 
	  
      $adoptList = new TableBuilder("shop");
	  $adoptList->setAlign(new Align("center", "middle"));
      $adoptList->buildHeaders("Image", "Class", "Type", "Description", "Fuzz Puff Price", "Dream Price",  "Buy");	
	  $adoptList->setHelper(new ShopTableHelper);	  
      $this->adopts = $this->getadopttypes();
	  
	  foreach($this->adopts as $stockadopt){
	     $adopt = $this->getadopt($stockadopt->type);
	     $image = new TCell($this->getadoptimage($adopt->eggimage));
		 $class = new TCell($adopt->class);
		 $type = new TCell($adopt->type);
		 $description = new TCell($adopt->description);
		 $price = new TCell($adopt->cost);
		 $price2 = new TCell($adopt->cost2);
		 $buy = new TCell($adoptList->getHelper()->getAdoptPurchaseForm($this, $adopt));
		 $adoptList->buildRow(array($image, $class, $type, $description, $price, $price2, $buy));
	  }	  
	  $document->add($adoptList);  	  
  }
  
  public function getadopt($id){
      // This method retrieves a new Stock adoptable
	  return new StockAdopt($id);
  }
  
  public function purchase($adopt){
      // This method carries out the purchase transaction of an adoptable object
  
      $mysidia = Registry::get("mysidia");
	  if($adopt->owner != $mysidia->user->username) Throw new NoPermissionException('Something is very very wrong, please contact an admin asap.');
	  else{
	     $cost = $adopt->getcost($this->salestax);
	     $cost2 = $adopt->getcost2($this->salestax);
		 $moneyleft = $mysidia->user->money - $cost;
		 $money2left = $mysidia->user->money2 - $cost2;
		 if($moneyleft >= 0 && $money2left>= 0){	
            $purchase = $adopt->append($adopt->owner);
            $mysidia->db->update("users", array("money" => $moneyleft, "money2" => $money2left), "username = '{$adopt->owner}'");
            $status = TRUE;
         }			
	     else throw new InvalidActionException($mysidia->lang->money);
	  }
	  return $status;
  }
  
  public function rent($adopt, $period){
      // This method will be added in future
  }
  
  public function execute($action){
      // This method will be added in future 
  }
}
?>
class_itemshop:
PHP:
<?php

class Itemshop extends ItemContainer{
  public $sid;
  public $category;
  public $shopname;
  public $shoptype;
  public $description;
  public $imageurl;
  public $status;
  public $restriction;
  public $salestax;
  public $items;
  protected $total = 0;
  
  public function __construct($shopname){
      // Fetch the database info into object property
	  
	  $mysidia = Registry::get("mysidia");
	  $row = $mysidia->db->select("shops", array(), "shopname ='{$shopname}'")->fetchObject();
	  if(!is_object($row)) throw new Exception("Invalid Shopname specified");
	  
	  // loop through the anonymous object created to assign properties
      foreach($row as $key => $val){
         $this->$key = $val;		 
      }

      $this->items = $this->getitemnames();
	  $this->total = (is_array($this->items))?count($this->items):0;
  }

  public function getcategory(){
      // This method checks if the shop category exists in items database or not
	  
	  $mysidia = Registry::get("mysidia");
	  $stmt = $mysidia->db->select("shops", array(), "category ='{$this->category}'");
      $cate_exist = ($row = $stmt->fetchObject())?TRUE:FALSE;     
	  return $cate_exist;
  }
  
  public function getshop(){
      // This method check if a shop exists in database or not
	  
	  $mysidia = Registry::get("mysidia");
	  if(empty($this->shopname)) $shop_exist = FALSE;
	  else{
	     $stmt = $mysidia->db->select("shops", array(), "shopname ='{$this->shopname}'");
		 $shop_exist = ($row = $stmt->fetchObject())?TRUE:FALSE;    
	  }
	  return $shop_exist;
  }
  
  public function getitemnames(){
  	 if(!$this->items){
	    // The iids have yet to be loaded, lets acquire their info from database
		$mysidia = Registry::get("mysidia");
		
		$stmt = $mysidia->db->select("items", array("itemname"), "shop ='{$this->shopname}'");
		$items = array();
		
		while($item = $stmt->fetchColumn()){
		   $items[] = $item;
		}
		return $items;
	 }
	 else return $this->items;
  }
  
  public function gettotal(){
      // This method returns the total number of item types available
	  
	  return $this->total;
  }
  
  public function display(){
      // This method displays the shoplist to users. It may look messy at this moment, but not after we create a table class
	
	  $mysidia = Registry::get("mysidia");
	  $document = $mysidia->frame->getDocument();			  
	  $document->addLangvar($mysidia->lang->select_item);
	  
      if($this->gettotal() == 0){
         $document->addLangvar($mysidia->lang->empty);
		 return FALSE;
      }	 
	  
	  $itemList = new TableBuilder("shop");
	  $itemList->setAlign(new Align("center", "middle"));
      $itemList->buildHeaders("Image", "Category", "Name", "Description", "Fuzz Puff Price", "Dream Price", "Buy");	
	  $itemList->setHelper(new ShopTableHelper);
	  
	  foreach($this->items as $stockitem){
	  	 $item = $this->getitem($stockitem);
	     $image = new TCell($this->getitemimage($item->imageurl));
		 $category = new TCell($item->category);
		 $itemname = new TCell($item->itemname);
		 $description = new TCell($item->description);
		 $price = new TCell($item->price);
		 $price2 = new TCell($item->price2);
		 $buy = new TCell($itemList->getHelper()->getItemPurchaseForm($this, $item));
		 $itemList->buildRow(array($image, $category, $itemname, $description, $price, $price2, $buy));
      }	  
	  $document->add($itemList);  
  }
  
  public function getitem($itemname){
      // This method retrieves a new Stock item
	  return new StockItem($itemname);
  }
  
  public function purchase(Item $item){
      // This method carries out the purchase transaction of an item object
  
      $mysidia = Registry::get("mysidia");
	  if($item->owner != $mysidia->user->username) Throw new NoPermissionException('Something is very very wrong, please contact an admin asap.');
	  else{
         $item->quantity = $mysidia->input->post("quantity");
	     $cost = $item->getcost($this->salestax, $item->quantity);
	     $cost2 = $item->getcost2($this->salestax, $item->quantity);
		 $moneyleft = $mysidia->user->money - $cost;
		 $money2left = $mysidia->user->money2 - $cost2;
		 if($moneyleft >= 0 and $money2left >= 0 and $item->quantity > 0){	
            $purchase = $item->append($item->quantity, $item->owner);
            $mysidia->db->update("users", array("money" => $moneyleft, "money2" => $money2left), "username = '{$item->owner}'");			
            $status = TRUE;
         }			
	     else throw new InvalidActionException($mysidia->lang->money);
	  }
	  return $status;
  }
  
  public function rent($item, $period){
      // This method will be added in future
  }
  
  public function execute($action){
      // This method will be added in future 
  }
}
?>
 
I see, you can fix the slashes issue by adding function stripslashes($yourtext) to each content in TCell(except for the image). But it may not be necessary, perhaps you can start with $item->description only at first(so change TCell($item->description) to TCell(stripslashes($item->description))), since I speculate that the slashes issue is mainly there. If it also appears somewhere else, lemme know and I will see what I can do to fix it further for you.
 
@HoF
Thank you so much for this! I'll go see if it works. :p
I also have this problem with adoptable bios, but seeing what you fixed, I may be able to get it done myself. Thanks! :D
 
You are very welcome, give a try fixing your site and lemme know how it works. Id be glad to assist you further if anything goes wrong.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,132
Members
1,603
Latest member
Monako
BETA

Latest Threads

Top