Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php class ModelSuperseoboxindex extends Model { private $ssb_data;private $ssb_helper,$t..

Decoded Output download

<?php class ModelSuperseoboxindex extends Model { private $ssb_data;private $ssb_helper,$tax,$customer,$patternsSettings;private $total=0;private $gen_pack_number=0;private $totalProdFromCategory=array();private $only_empty=false;private $empty_column='';function __construct(){ global $registry;parent::__construct($registry);require_once DIR_CONFIG.'ssb_library/ssb_data.php';$this->ssb_data=ssb_data::getInstance();require_once DIR_CONFIG.'ssb_library/ssb_helper.php';$this->ssb_helper=ssb_helper::getInstance();if($this->ssb_helper->getVerOC() >=22){ $customer=new Cart\Customer($this->registry);$tax=new Cart\Tax($this->registry);}else{ include_once(DIR_SYSTEM.'library/customer.php');include_once(DIR_SYSTEM.'library/tax.php');$customer=new Customer($registry);$tax=new Tax($registry);} $registry->set('customer',$customer);$registry->set('tax',$tax);$this->customer=$customer;$this->tax=$tax;$this->patternsSettings=$this->ssb_data->getSetting('patternsSettings');} public function getCPBI_item($CPBI,$id_item){ $data_CPBI_item=$this->{'get_'.$CPBI}('',$id_item);return $data_CPBI_item;} public function getCPBI($CPBI,$categoryEntity='',$gen_pack_number=0,$internal_entity='',$only_empty=false){ $this->only_empty=$only_empty !==false ? true:$this->only_empty;if($this->only_empty){ echo 'getCPBI => '.$categoryEntity.'</br>';if($categoryEntity !='urls' AND $categoryEntity !='related_prod' AND $categoryEntity !='reviews' AND $categoryEntity !='images'){ $categoryEntites=$this->ssb_data->getMatadata('CategoryEntites');$this->empty_column=$categoryEntites[$categoryEntity]['column'];}elseif($categoryEntity=='urls'){ $this->empty_column='';}elseif($categoryEntity=='related_prod'){ $this->empty_column='';}elseif($categoryEntity=='reviews'){ $this->empty_column='';} } $data_CPBI=array();$time_start=microtime(true);$this->gen_pack_number=$gen_pack_number;if($CPBI=='CPBI_urls' AND $internal_entity==''){ $CPBI='all';}elseif($internal_entity !=''){ $CPBI=$internal_entity;} if($CPBI=='all'){ if($categoryEntity=='' OR $categoryEntity=='urls'){ $CPBIs=$this->ssb_data->getMatadata('CPBI',array('keys'=>true));}else{ $MD_entities=$this->ssb_data->getMatadata('Entites');$CPBIs=array_keys($MD_entities[$categoryEntity]);} $total=0;foreach($CPBIs as $CPBI_){ $data=$this->getCPBI($CPBI_,$categoryEntity,$gen_pack_number);$total+=$data['total'];$data_CPBI['data'][$CPBI_]=$data['data'];} $data_CPBI['total']=$total;$data_CPBI['name']='all';}else{ $gen_pack=$this->ssb_data->getGenPack($gen_pack_number,$CPBI,$categoryEntity);if($CPBI=='related_prod' OR $CPBI=='images' OR $categoryEntity=='images' OR $categoryEntity=='reviews'){ $CPBI='product';} $data_CPBI=$this->{'get_'.$CPBI}($gen_pack);} $this->ssb_data->getSpecialPatterns();if($this->only_empty){ } return $data_CPBI;} private function get_product($gen_limit='',$item_id=''){ $languages=$this->ssb_helper->getLanguages();$this->total=0;$respond=array();foreach ($languages as $l_code=> $l_data){ if(isset($_SESSION['gener_lang']) AND $_SESSION['gener_lang'] !=$l_code)continue;$respond_lang=$this->get_product_lang($l_data,$gen_limit,$item_id);$respond =array_replace_recursive ($respond,$respond_lang);} return array('data'=> $respond,'total'=> $this->total,'name'=> 'product');} private function get_product_lang($l_data,$gen_limit,$item_id){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];$sql="SELECT pd.title_image, pd.alt_image, pd.tag, pd.meta_description, pd.meta_keyword, pd.seo_title, pd.seo_h1, pd.seo_h2, pd.seo_h3, pd.meta_seo_data, p.product_id, p.tax_class_id, p.price, (SELECT price FROM ".DB_PREFIX2."product_special sp where sp.product_id = p.product_id limit 1) as sp_price, p.model, m.name as b_name, p.sku, p.upc, p.isbn, pd.name, p.image, pd.description, md.description as b_description FROM ".DB_PREFIX2."product_description pd    INNER JOIN ".DB_PREFIX2."product p on pd.product_id = p.product_id     LEFT  JOIN ".DB_PREFIX2."manufacturer m on m.manufacturer_id = p.manufacturer_id    LEFT  JOIN ".DB_PREFIX2."manufacturer_description md on m.manufacturer_id = md.manufacturer_id and md.language_id = ".$l_id ." WHERE  pd.language_id = ".$l_id;if($this->empty_column){ $sql.=" AND pd.".$this->empty_column."=''";} if($item_id !==''){ $sql.=" AND p.product_id =".$item_id.";";}else{ $sql.=" LIMIT ".(int)$gen_limit['start'].",".(int)$gen_limit['limit'].";";} $query=$this->db2->query($sql);$data_currency = isset($this->session->data['currency']) ? $this->session->data['currency'] : $this->config->get('config_currency');$products=array();foreach($query->rows as $product){ if(!isset($products [$product['product_id']][$l_code])){ $sql="SELECT cd.category_id as c_id, cd.name as c_name, cd.description as c_description FROM ".DB_PREFIX2."product_to_category pc       INNER  JOIN ".DB_PREFIX2."category_description cd on cd.category_id = pc.category_id and cd.language_id = ".(int)$l_data['language_id']."  WHERE pc.product_id = '" . $product['product_id'] . "';";$query_cat=$this->db2->query($sql);$categories=array('cn'=> array(),'c_id' => array(),'cd'=> array());foreach($query_cat->rows as $category){ $categories['cn'][] =$category['c_name'];$categories['c_id'][] =$category['c_id'];$categories['cd'][] =$category['c_description'];} if($this->patternsSettings['pp']['setting']['add_tax']){ $p_price=$this->currency->format($this->tax->calculate($product['price'],$product['tax_class_id'],$this->config->get('config_tax')),$data_currency);}else{ $p_price=$this->currency->format($product['price']);} if($this->patternsSettings['sp']['setting']['add_tax']){ if($product['sp_price']===NULL){ if($this->ssb_helper->getVerOC() >=22){ $p_sp_price=$this->currency->format($this->tax->calculate($product['price'],$product['tax_class_id'],$this->config->get('config_tax')),$data_currency);}else{ $p_sp_price=$this->currency->format($this->tax->calculate($product['price'],$product['tax_class_id'],$this->config->get('config_tax')));} }else{ if($this->ssb_helper->getVerOC() >=22){ $p_sp_price=$this->currency->format($product['price'],$data_currency);}else{ $p_sp_price=$this->currency->format($product['price']);} } }else{ if($this->ssb_helper->getVerOC() >=22){ $p_sp_price=$product['sp_price']===NULL ? $this->currency->format($product['price']):$this->currency->format($product['sp_price']);}else{ $p_sp_price=$product['sp_price']===NULL ? $this->currency->format($product['price']):$this->currency->format($product['sp_price']);} } $products [$product['product_id']][$l_code]=array( 'pn' => $product['name'],'pd' => $product['description'],'cn' => $categories['cn'],'c_id' => $categories['c_id'],'cd' => $categories['cd'],'bn' => $product['b_name'],'bd' => $product['b_description'],'pp' => $p_price,'sp' => $p_sp_price,'pm' => $product['model'],'ps' => $product['sku'],'pu' => $product['upc'],'pi' => $product['isbn'],'image' => $product['image'],'seo_field' => array( 'name' => $product['name'],'tags' => $product['tag'],'m_descrip' => $product['meta_description'],'m_keywords'=> $product['meta_keyword'],'titles' => $product['seo_title'],'seo_h1' => $product['seo_h1'],'seo_h2' => $product['seo_h2'],'seo_h3' => $product['seo_h3'],'descrip' => $product['description'],'alt_image' => $product['alt_image'],'title_image'=> $product['title_image'],'meta_seo_data'=> $product['meta_seo_data'] ) );$this->total++;} } return $products;} private function get_category($gen_limit='',$item_id=''){ $languages=$this->ssb_helper->getLanguages();$this->total=0;$respond=array();$this->totalProdFromCategory=array();foreach ($languages as $l_code=> $l_data){ if(isset($_SESSION['gener_lang']) AND $_SESSION['gener_lang'] !=$l_code)continue;$respond_lang=$this->get_category_lang($l_data,$gen_limit,$item_id);$respond =array_replace_recursive ($respond,$respond_lang);} return array('data'=> $respond,'total'=> $this->total,'name'=> 'category');} private function get_category_lang($l_data,$gen_limit,$item_id){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];$sql="SELECT c.parent_id, cd.tag, cd.title_image, cd.alt_image, cd.meta_description, cd.meta_keyword, cd.seo_title, cd.seo_h1, cd.seo_h2, cd.seo_h3, cd.meta_seo_data,  c.image as c_image, cd.category_id, cd.name, cd.description, cdp.name as parent_name FROM ".DB_PREFIX2."category c INNER JOIN ".DB_PREFIX2."category_description cd on c.category_id = cd.category_id LEFT  JOIN ".DB_PREFIX2."category_description cdp on (c.parent_id = cdp.category_id AND cdp.language_id = ".$l_id.") WHERE  cd.language_id = ".$l_id;if($this->empty_column){ $sql.=" AND cd.".$this->empty_column."=''";} if($item_id !==''){ $sql.=" AND c.category_id =".$item_id.";";}else{ $sql.=" LIMIT ".(int)$gen_limit['start'].",".(int)$gen_limit['limit'].";";} $query=$this->db2->query($sql);$categories=array();foreach($query->rows as $category){ if(!isset($categories[$category['category_id']][$l_code])){ if(!isset($this->totalProdFromCategory[$category['category_id']])){ $sql_total_prod="SELECT COUNT(product_id) as totalProd FROM ".DB_PREFIX2."product_to_category WHERE category_id = '". (int)$category['category_id'] ."';";$query_total=$this->db2->query($sql_total_prod);$this->totalProdFromCategory[$category['category_id']]=$query_total->rows[0]['totalProd'];if($this->totalProdFromCategory[$category['category_id']]==0){ $childrenCategory=array();$query_children=$this->db2->query("SELECT category_id FROM ".DB_PREFIX2."category WHERE parent_id = '" . (int)$category['category_id'] . "'");foreach ($query_children->rows as $category_children) { $sql_total_prod="SELECT COUNT(product_id) as totalProd FROM ".DB_PREFIX2."product_to_category WHERE category_id = '". (int)$category_children['category_id'] ."';";$query_total=$this->db2->query($sql_total_prod);$this->totalProdFromCategory[$category['category_id']]+=$query_total->rows[0]['totalProd'];} } } $query_children=isset($query_children) ? $query_children:$this->db2->query("SELECT category_id FROM ".DB_PREFIX2."category WHERE parent_id = '" . (int)$category['category_id'] . "'");$result_csd=array('cn'=> array(),'c_id' => array(),'cd'=> array());foreach ($query_children->rows as $category_children) { $sql="SELECT category_id, name, description FROM ".DB_PREFIX2."category_description  WHERE category_id = ".(int)$category_children['category_id']." AND language_id = ".$l_id;$query_csd=$this->db2->query($sql);if(isset($query_csd->rows[0])){ $result_csd['cn'][] =$query_csd->rows[0]['name'];$result_csd['c_id'][] =$query_csd->rows[0]['category_id'];$result_csd['cd'][] =$query_csd->rows[0]['description'];} } $ep_data=array( 'totalProduct' => $this->totalProdFromCategory[$category['category_id']],'CPBI' => 'category','id' => $category['category_id'],'l_id' => $l_id );$exampleProducts=$this->getExampleProducts($ep_data);$categories [$category['category_id']][$l_code]=array( 'cn' => $category['name'],'cd'=> $category['description'],'cp'=> !is_null($category['parent_name']) ? $category['parent_name']:'','csn'=> $result_csd['cn'],'csn_id'=> $result_csd['c_id'],'csd'=> $result_csd['cd'],'ep'=> $exampleProducts,'tp'=> $this->totalProdFromCategory[$category['category_id']],'image'=> $category['c_image'],'seo_field' => array( 'name' => $category['name'],'tags' => $category['tag'],'m_descrip' => $category['meta_description'],'m_keywords'=> $category['meta_keyword'],'titles' => $category['seo_title'],'seo_h1' => $category['seo_h1'],'seo_h2' => $category['seo_h2'],'seo_h3' => $category['seo_h3'],'descrip' => $category['description'],'alt_image' => $category['alt_image'],'title_image' => $category['title_image'],'meta_seo_data'=> $category['meta_seo_data'] ) );$this->total++;} } return $categories;} private function get_brand($gen_limit='',$item_id=''){ $languages=$this->ssb_helper->getLanguages();$this->total=0;$respond=array();foreach ($languages as $l_code=> $l_data){ if(isset($_SESSION['gener_lang']) AND $_SESSION['gener_lang'] !=$l_code)continue;$respond_lang=$this->get_brand_lang($l_data,$gen_limit,$item_id);$respond =array_replace_recursive ($respond,$respond_lang);} return array('data'=> $respond,'total'=> $this->total,'name'=> 'brand');} private function get_brand_lang($l_data,$gen_limit,$item_id){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];$sql="SELECT md.tag, md.meta_description, md.meta_keyword, md.seo_title, md.seo_h1, md.seo_h2, md.seo_h3, md.meta_seo_data, m.image, m.manufacturer_id, m.name, md.description FROM ".DB_PREFIX2."manufacturer m     LEFT JOIN ".DB_PREFIX2."manufacturer_description md on m.manufacturer_id = md.manufacturer_id";$where=false;$lang_count=count($this->ssb_helper->getLanguages());if($lang_count > 1){ $where=true;$sql.=" WHERE (md.language_id = ".$l_id." OR 1)";} if($this->empty_column){ $sql.=$where ? " AND md.".$this->empty_column."=''":" WHERE md.".$this->empty_column."=''";$where=true;} if($item_id !==''){ $sql.=$where ? " AND m.manufacturer_id =".$item_id.";":" WHERE m.manufacturer_id =".$item_id.";";}else{ $sql.=" LIMIT ".(int)$gen_limit['start'].",".(int)$gen_limit['limit'].";";} $query=$this->db2->query($sql);$brands=array();$totalProd=array();foreach($query->rows as $brand){ if(!isset($brands[$brand['manufacturer_id']][$l_code])){ if(!isset($totalProd[$brand['manufacturer_id']])){ $sql_total_prod="SELECT COUNT(product_id) as totalProd FROM ".DB_PREFIX2."product WHERE manufacturer_id = '". $brand['manufacturer_id'] ."';";$query_total=$this->db2->query($sql_total_prod);$totalProd[$brand['manufacturer_id']]=$query_total->rows[0]['totalProd'];} $ep_data=array( 'totalProduct' => $totalProd[$brand['manufacturer_id']],'CPBI' => 'brand','id' => $brand['manufacturer_id'],'l_id' => $l_id );$exampleProducts=$this->getExampleProducts($ep_data);$brands[$brand['manufacturer_id']][$l_code]=array( 'bn' => $brand['name'],'bd'=> isset($brand['description']) ? $brand['description']:'','ep'=> $exampleProducts,'tp'=> $totalProd[$brand['manufacturer_id']],'image'=> $brand['image'],'seo_field' => array( 'name' => $brand['name'],'tags' => isset($brand['tag']) ? $brand['tag']:'','m_descrip'=> isset($brand['meta_description']) ? $brand['meta_description']:'','m_keywords'=> isset($brand['meta_keyword']) ? $brand['meta_keyword']:'','titles' => isset($brand['seo_title']) ? $brand['seo_title']:'','seo_h1' => isset($brand['seo_h1']) ? $brand['seo_h1']:'','seo_h2' => isset($brand['seo_h2']) ? $brand['seo_h2']:'','seo_h3' => isset($brand['seo_h3']) ? $brand['seo_h3']:'','descrip' => isset($brand['description']) ? $brand['description']:'','meta_seo_data'=> isset($brand['meta_seo_data']) ? $brand['meta_seo_data']:'' ) );$this->total++;} } return $brands;} private function get_info($gen_limit='',$item_id=''){ $languages=$this->ssb_helper->getLanguages();$this->total=0;$respond=array();foreach ($languages as $l_code=> $l_data){ if(isset($_SESSION['gener_lang']) AND $_SESSION['gener_lang'] !=$l_code)continue;$respond_lang=$this->get_info_lang($l_data,$gen_limit,$item_id);$respond =array_replace_recursive ($respond,$respond_lang);} return array('data'=> $respond,'total'=> $this->total,'name'=>'information');} private function get_info_lang($l_data,$gen_limit,$item_id){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];$sql="SELECT id.tag, id.meta_description, id.meta_keyword, id.seo_title, id.information_id, id.title as name, id.description, id.meta_seo_data FROM ".DB_PREFIX2."information_description id WHERE id.language_id = ".$l_id;if($this->empty_column){ $sql.=" AND id.".$this->empty_column."=''";} if($item_id !==''){ $sql.=" AND id.information_id =".$item_id.";";}else{ $sql.=" LIMIT ".(int)$gen_limit['start'].",".(int)$gen_limit['limit'].";";} $query=$this->db2->query($sql);$infos=array();foreach($query->rows as $info){ if(!isset($infos[$info['information_id']][$l_code])){ $infos[$info['information_id']][$l_code]=array( 'in' => $info['name'],'id'=> $info['description'],'seo_field' => array( 'name' => $info['name'],'tags' => $info['tag'],'m_descrip'=> $info['meta_description'],'m_keywords'=> $info['meta_keyword'],'titles' => $info['seo_title'],'descrip' => $info['description'],'meta_seo_data'=> $info['meta_seo_data'] ) );$this->total++;} } return $infos;} private function get_CPBI_urls(){ return $this->getCPBI('all','',$this->gen_pack_number);} private function get_STAN_urls(){ return array('data'=> array(),'total'=> 0,'name'=> 'STAN_urls');} private function get_related_prod(){ return $this->getCPBI('product','',$this->gen_pack_number);} public function delCPBI_Cache($CPBI='all'){ if ($CPBI !='all'){ $this->cache->delete('ssb.CPBI.'.$CPBI);}else{ $CPBIs=$this->ssb_data->getMatadata('CPBI',array('keys'=>true));foreach($CPBIs as $val){ $this->cache->delete('ssb.CPBI.'.$val);} } } public function getCountries($continent_code='') { if(!$continent_code){ $sql="SELECT c.name as name, c.code FROM ".DB_PREFIX2."wc_countries c ORDER BY c.name";} else{ $sql="SELECT c.name as name, c.code FROM ".DB_PREFIX2."wc_countries c WHERE continent_code = '". $continent_code ."' ORDER BY c.name";} $query=$this->db2->query($sql);return $query->rows;} public function getContinents() { $sql="SELECT name, code, geonameId FROM ".DB_PREFIX2."wc_continents c ORDER BY c.name";$query=$this->db2->query($sql);return $query->rows;} public function getTotalSEOField($data,$all=false) { $page=isset($data['page']) ? (int)$data['page']:1;$page=$page==0 ? 1:$page;$data['start']=($page-1) * 20;$data['limit']=20;$this->load->model('tool/image');$func='getTotalSEOField_'.$data['type'];if(isset($data['need_language_id'])){ $l_id=$data['need_language_id'];}else{ $l_id='';} $respond=$this->$func($data,$all,$l_id);if(!count($respond['content']) AND isset($data['filter_name']) AND $data['filter_name']){ $languages=$this->ssb_helper->getLanguages();$defaultLanguge=$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());foreach ($languages as $l_code=> $l_data){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];if($l_id !=$defaultLanguge){ $respond=$this->$func($data,$all,$l_id);} if(count($respond['content'])){ $respond['need_language_id']=$l_id;break;} } } if($data['type']=='home' OR $data['type']=='standardPage'){ }else{ $type=$data['type']=='brand' ? 'manufacturer':$data['type'];$type=$data['type']=='info' ? 'information':$type;$this->load->model('catalog/'.$type);$model_catalog_type='model_catalog_'.$type;$func_pag = $respond['pagination'];$item_total = $this->$model_catalog_type->$func_pag($data);$pagination=$this->getPaginationPrepare($item_total,$data,$data['type']);$respond['pagination']=$pagination;} return $respond;} private function getTotalSEOField_home($data,$all,$defaultLanguge=''){ } private function getTotalSEOField_standardPage($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT * FROM ".DB_PREFIX2."url_alias WHERE  auto_gen = 'STAN_urls' AND language_id = ".$defaultLanguge;$query=$this->db2->query($sql);foreach ($query->rows as $result) { $language_data=array( 'query' => $result['query'],'keyword' => $result['keyword'] );$respond[$result['url_alias_id']]['data'][$result['language_id']]=$language_data;} return array('content'=> $respond,'pagination'=> '');} private function getTotalSEOField_product($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT p.image, pd.product_id, pd.name, pd.tag, pd.meta_description, pd.meta_keyword, pd.seo_title, pd.seo_h1,  pd.seo_h2, pd.seo_h3, pd.description, pd.language_id FROM ".DB_PREFIX2."product_description pd INNER JOIN ".DB_PREFIX2."product p ON p.product_id = pd.product_id WHERE  pd.language_id = ".$defaultLanguge;$sql=$this->getSQLPrepare("p.status","pd.name",$data,$sql);$query=$this->db2->query($sql);foreach($query->rows as $result){ $language_data=array( 'name' => $result['name'],'tags' => $result['tag'],'m_descrip'=> $result['meta_description'],'m_keywords'=> $result['meta_keyword'],'titles' => $result['seo_title'],'seo_h1' => $result['seo_h1'],'seo_h2' => $result['seo_h2'],'seo_h3' => $result['seo_h3'],'descrip' => $result['description'],'urls' => $this->getKeyword('product_id='.$result['product_id'],$defaultLanguge) );if(!isset($respond[$result['product_id']]['related'])){ $sql="SELECT pd.name, pr.related_id FROM ".DB_PREFIX2."product_related pr INNER JOIN ".DB_PREFIX2."product_description pd ON (pd.product_id = pr.related_id AND pd.language_id = ".$defaultLanguge." ) WHERE pr.product_id = '" . $result['product_id'] . "';";$query_related=$this->db2->query($sql);$product_related_data=array();$related_onlyId=array();foreach ($query_related->rows as $result_r) { $related_onlyId[]=(int)$result_r['related_id'];$product_related_data[]=array( 'related_id'=> (int)$result_r['related_id'],'name'=> $result_r['name'],'id'=> (int)$result_r['related_id'],'text'=> $result_r['name'],);} $respond[$result['product_id']]['related']=$product_related_data;$respond[$result['product_id']]['related_onlyId']=$related_onlyId;} $respond[$result['product_id']]['data'][$result['language_id']]=$language_data;if ($result['image'] && file_exists(DIR_IMAGE.$result['image'])) { $image=$this->model_tool_image->resize($result['image'],60,60);} else { $image=$this->model_tool_image->resize('no_image.jpg',60,60);} $respond[$result['product_id']]['image']=$image;} return array('content'=> $respond,'pagination'=> 'getTotalProducts');} private function getTotalSEOField_category($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT c.image, cd.category_id, cd.name, cd.tag, cd.meta_description, cd.meta_keyword, cd.seo_title, cd.seo_h1, cd.seo_h2, cd.seo_h3, cd.description, cd.language_id FROM ".DB_PREFIX2."category_description cd INNER JOIN ".DB_PREFIX2."category c ON c.category_id = cd.category_id WHERE  cd.language_id = ".$defaultLanguge;$sql=$this->getSQLPrepare("c.status","cd.name",$data,$sql);$query=$this->db2->query($sql);foreach ($query->rows as $result) { $language_data=array( 'name' => $result['name'],'tags' => $result['tag'],'m_descrip'=> $result['meta_description'],'m_keywords'=> $result['meta_keyword'],'titles' => $result['seo_title'],'seo_h1' => $result['seo_h1'],'seo_h2' => $result['seo_h2'],'seo_h3' => $result['seo_h3'],'descrip' => $result['description'],'urls' => $this->getKeyword('category_id='.$result['category_id'],$defaultLanguge) );$respond[$result['category_id']]['data'][$result['language_id']]=$language_data;if ($result['image'] && file_exists(DIR_IMAGE.$result['image'])) { $image=$this->model_tool_image->resize($result['image'],60,60);} else { $image=$this->model_tool_image->resize('no_image.jpg',60,60);} $respond[$result['category_id']]['image']=$image;} return array('content'=> $respond,'pagination'=> 'getTotalCategories');} private function getTotalSEOField_brand($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT m.image, m.manufacturer_id, m.name, md.tag, md.meta_description, md.meta_keyword, md.seo_title, md.seo_h1,  md.seo_h2, md.seo_h3, md.description, md.language_id FROM ".DB_PREFIX2."manufacturer_description md INNER JOIN ".DB_PREFIX2."manufacturer m ON m.manufacturer_id = md.manufacturer_id WHERE  md.language_id = ".$defaultLanguge;$sql=$this->getSQLPrepare("","m.name",$data,$sql);$query=$this->db2->query($sql);foreach ($query->rows as $result) { $language_data=array( 'name' => $result['name'],'tags' => isset($result['tag']) ? $result['tag']:'','m_descrip'=> isset($result['meta_description']) ? $result['meta_description']:'','m_keywords'=> isset($result['meta_keyword']) ? $result['meta_keyword']:'','titles' => isset($result['seo_title']) ? $result['seo_title']:'','seo_h1' => isset($result['seo_h1']) ? $result['seo_h1']:'','seo_h2' => isset($result['seo_h2']) ? $result['seo_h2']:'','seo_h3' => isset($result['seo_h3']) ? $result['seo_h3']:'','descrip' => isset($result['description']) ? $result['description']:'','urls' => $this->getKeyword('manufacturer_id='.$result['manufacturer_id'],$defaultLanguge) );$respond[$result['manufacturer_id']]['data'][$defaultLanguge]=$language_data;if ($result['image'] && file_exists(DIR_IMAGE.$result['image'])) { $image=$this->model_tool_image->resize($result['image'],60,60);} else { $image=$this->model_tool_image->resize('no_image.jpg',60,60);} $respond[$result['manufacturer_id']]['image']=$image;} return array('content'=> $respond,'pagination'=> 'getTotalManufacturers');} private function getTotalSEOField_info($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT id.information_id, id.title, id.seo_title, id.tag, id.meta_description, id.meta_keyword,  id.description, id.language_id FROM ".DB_PREFIX2."information_description id INNER JOIN ".DB_PREFIX2."information i ON i.information_id = id.information_id WHERE  id.language_id = ".$defaultLanguge;$sql=$this->getSQLPrepare("i.status","id.title",$data,$sql);$query=$this->db2->query($sql);foreach ($query->rows as $result) { $language_data=array( 'name' => $result['title'],'tags' => $result['tag'],'m_descrip'=> $result['meta_description'],'m_keywords'=> $result['meta_keyword'],'titles' => $result['seo_title'],'urls' => $this->getKeyword('information_id='.$result['information_id'],$defaultLanguge) );$respond[$result['information_id']]['data'][$result['language_id']]=$language_data;} return array('content'=> $respond,'pagination'=> 'getTotalInformations');} private function getSQLPrepare($status='',$d_name,$data,$sql){ if (isset($data['filter_name'])) { $sql.=" AND ".$d_name." LIKE '%" . $this->db2->escape($data['filter_name']) . "%'";} if($status){ $sql.=" AND ".$status." = 1";} $sql.=" ORDER BY ".$d_name;if (isset($data['order']) && ($data['order']=='DESC')) { $sql.=" DESC";} else { $sql.=" ASC";} $sql.=" LIMIT ".(int)$data['start'].",".(int)$data['limit'];return $sql;} private function getPaginationPrepare($item_total,$data,$type){ $l_data=$this->language->load('module/superseobox');$url='&metaData[action]=getGenEditorContent&data[type]='.$data['type'];if (isset($data['order'])) { $url.='&data[order]='.$data['order'];} if (isset($data['filter_name'])) { $url.='&data[filter_name]='.urlencode(html_entity_decode($data['filter_name'],ENT_QUOTES,'UTF-8'));} if (isset($data['page'])) { $page=$data['page'];} else { $page=1;} $pagination =new Pagination();$pagination->total =$item_total;$pagination->page =$page;$pagination->limit =20;$pagination->text =$l_data['pagination_text'];$pagination->url =$this->url->link('module/superseobox/ajax','token='.$this->session->data['token'].$url.'&data[page]={page}','SSL');$pagination=$pagination->render();return $pagination;} public function saveGenEditorContent($data){ if(isset($data['del_array'])){ foreach($data['del_array'] as $id){ $this->db2->query("DELETE FROM ".DB_PREFIX2."url_alias WHERE url_alias_id = '" . (int)$id . "'");} return true;} $item_id=$data['item_id'];$data['item_type']=$data['item_type']=='brand' ? 'manufacturer':$data['item_type'];$data['table']=$data['item_type']=='standardPage' ? 'standardPage':$data['table'];$data['item_type']=$data['item_type']=='info' ? 'information':$data['item_type'];if($data['item_type']=='manufacturer' AND $data['column']=='name'){ $data['table']='manufacturer';} if($data['item_type']=='information' AND $data['column']=='name'){ $data['column']='title';} switch ($data['table']) { case 'url_alias':$query=$data['item_type'].'_id='.$item_id;$check=$this->db2->query("SELECT * FROM ".DB_PREFIX2."url_alias WHERE query = '" . $query . "' AND language_id = ".$data['lang_id'].";");if(count($check->rows)){ $sql="UPDATE ".DB_PREFIX2."url_alias SET keyword = '" .  $this->db2->escape($data['value']) . "' WHERE query = '" . $query . "' AND language_id = ".$data['lang_id'].";";}else{ $sql="INSERT INTO ".DB_PREFIX2."url_alias SET keyword = '" . $this->db2->escape($data['value']) . "', query = '" . $query . "', auto_gen = 'CPBI_urls', language_id = ".$data['lang_id'].";";} break;case 'product_related':echo 'product_related';break;case 'home':echo 'home';break;case 'standardPage':$col_id_name='url_alias_id';if($item_id !=''){ $sql="UPDATE ".DB_PREFIX2."url_alias SET ".$data['column']." = '" .  $this->db2->escape($data['value']) . "' WHERE ".$col_id_name." = '" . $item_id . "' AND language_id = ".$data['lang_id'].";";}else{ $sql="INSERT INTO ".DB_PREFIX2."url_alias SET ".$data['column']." = '" .  $this->db2->escape($data['value']) . "', auto_gen = 'STAN_urls', language_id = ".$data['lang_id'].";";} break;default:if($data['item_type']=='manufacturer' AND $data['column']=='name'){ $col_id_name='manufacturer_id';$sql="UPDATE ".DB_PREFIX2.$data['table']." SET ".$data['column']." = '" .  $this->db2->escape($data['value']) . "' WHERE ".$col_id_name." = '" . $item_id . "';";}else{ $col_id_name=$data['item_type'].'_id';$sql="UPDATE ".DB_PREFIX2.$data['table']." SET ".$data['column']." = '" .  $this->db2->escape($data['value']) . "' WHERE ".$col_id_name." = '" . $item_id . "' AND language_id = ".$data['lang_id'].";";} } $this->db2->query($sql);return $this->db2->getLastId();} private function saveGenEditorContent_product($data){ $item_id=$data['item_id'];return true;} private function saveGenEditorContent_category($data){ $item_id=$data['item_id'];$this->saveToDescripUrlTable('category_id','category_description',$data,$item_id);return true;} private function saveGenEditorContent_brand($data){ $item_id=$data['item_id'];$this->saveToDescripUrlTable('manufacturer_id','manufacturer_description',$data,$item_id);return true;} private function saveGenEditorContent_info($data){ $item_id=$data['item_id'];$d_name='information_id';$table='information_description';foreach($data['content'] as $lang_id=> $content){ $tag =$this->db2->escape($content['tag']);$m_keyword =$this->db2->escape($content['meta_keyword']);$m_description =$this->db2->escape($content['meta_description']);$title =$this->db2->escape($content['title']);$description=$this->db2->escape($content['description']);$sql="UPDATE ".DB_PREFIX2.$table." SET tag = '". $tag  ."', meta_keyword = '". $m_keyword ."', meta_description = '". $m_description ."', seo_title = '". $title ."' WHERE ".$d_name." = ".$item_id." AND language_id = ".$lang_id.";";$query=$this->db2->query($sql);$keyword =$content['keyword'];if($keyword <> ''){ $sql="UPDATE ".DB_PREFIX2."url_alias SET keyword = '". $keyword ."' WHERE query = '".$d_name."=". $item_id ."' AND language_id = ".$lang_id.";";$query=$this->db2->query($sql);} } return true;} private function saveToDescripUrlTable($d_name,$table,$data,$item_id){ foreach($data['content'] as $lang_id=> $content){ $tag =$this->db2->escape($content['tag']);$m_keyword =$this->db2->escape($content['meta_keyword']);$m_description =$this->db2->escape($content['meta_description']);$title =$this->db2->escape($content['title']);$description=$this->db2->escape($content['description']);$seo_h1 =$this->db2->escape($content['seo_h1']);$seo_h2 =$this->db2->escape($content['seo_h2']);$seo_h3 =$this->db2->escape($content['seo_h3']);$sql="UPDATE ".DB_PREFIX2.$table." SET tag = '". $tag  ."', meta_keyword = '". $m_keyword ."', meta_description = '". $m_description ."', seo_title = '". $title ."', description = '". $description ."', seo_h1 = '". $seo_h1 ."', seo_h2 = '". $seo_h2 ."', seo_h3 = '". $seo_h3 ."' WHERE ".$d_name." = ".$item_id." AND language_id = ".$lang_id.";";$query=$this->db2->query($sql);$keyword =$content['keyword'];if($keyword <> ''){ $sql="UPDATE ".DB_PREFIX2."url_alias SET keyword = '". $keyword ."' WHERE query = '".$d_name."=". $item_id ."' AND language_id = ".$lang_id.";";$query=$this->db2->query($sql);} } } private function getExampleProducts($data,$get_total=9){ $query_prods=array();if( $data['totalProduct']==0)return $query_prods;if($data['CPBI']=='category'){ $sql_start="SELECT pd.name FROM ".DB_PREFIX2."product_description pd       LEFT JOIN ".DB_PREFIX2."product_to_category pc ON pc.product_id = pd.product_id      WHERE pc.category_id = '".$data['id']."' AND pd.language_id = '". $data['l_id'];    }else{     $sql_start = "SELECT pd.name FROM ". DB_PREFIX2 ."product p       LEFT JOIN ". DB_PREFIX2 ."product_description pd ON pd.product_id = p.product_id      WHERE p.manufacturer_id = '".$data['id']."' AND pd.language_id = '".$data['l_id'];} if($data['totalProduct'] > $get_total){ $rand_prod=rand(0,$data['totalProduct']-$get_total);}else{ $rand_prod=0;} $sql_finish="' LIMIT ". $rand_prod .", ". $get_total .";";    $sql_prod = $sql_start . $sql_finish;    $query_prod = $this->db2->query($sql_prod);    foreach($query_prod->rows as $row){     $query_prods[] = $row['name'];    }    return $query_prods;   }   private function getSentences($text , $count) {    $text = strip_tags(html_entity_decode($text));    $pos = 0;    $found = false;    for ($x=0; $x<=$count; $x++)    {     $pos = strpos($text, '.', 0);     if($pos !== false){      $found = true;     }    }    if($found){     if($pos === false) {      return $text;     }else{      return substr($text, 0, $pos+1);     }    }   }   private function getKeyword($query_string, $language_id){    $result_= '';    $sql_ = "SELECT * FROM " . DB_PREFIX2 . "url_alias WHERE query='".$query_string."' AND language_id = " . $language_id;    $query_ = $this->db2->query($sql_);    if(count($query_->rows)){     $result_ = $query_->rows[0]['keyword'];    }else{     $sql_ = "SELECT * FROM " . DB_PREFIX2 . "url_alias WHERE query='".$query_string."';";     $query_ = $this->db2->query($sql_);     if(count($query_->rows))$result_ = $query_->rows[0]['keyword'];    }    return $result_;   }  }  if (!function_exists('array_replace_recursive'))  {    function array_replace_recursive($array, $array1)    {      $args = func_get_args();      $array = $args[0];      if (!is_array($array))      {        return $array;      }      for ($i = 1; $i < count($args); $i++)      {        if (is_array($args[$i]))        {          $array = recurse($array, $args[$i]);        }      }      return $array;    }    function recurse($array, $array1)      {        foreach ($array1 as $key => $value)        {          if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key])))          {            $array[$key] = array();          }          if (is_array($value))          {            $value = recurse($array[$key], $value);          }          $array[$key] = $value;        }        return $array;      }  }  ?> 

Did this file decode correctly?

Original Code

<?php class ModelSuperseoboxindex extends Model { private $ssb_data;private $ssb_helper,$tax,$customer,$patternsSettings;private $total=0;private $gen_pack_number=0;private $totalProdFromCategory=array();private $only_empty=false;private $empty_column='';function __construct(){ global $registry;parent::__construct($registry);require_once DIR_CONFIG.'ssb_library/ssb_data.php';$this->ssb_data=ssb_data::getInstance();require_once DIR_CONFIG.'ssb_library/ssb_helper.php';$this->ssb_helper=ssb_helper::getInstance();if($this->ssb_helper->getVerOC() >=22){ $customer=new Cart\Customer($this->registry);$tax=new Cart\Tax($this->registry);}else{ include_once(DIR_SYSTEM.'library/customer.php');include_once(DIR_SYSTEM.'library/tax.php');$customer=new Customer($registry);$tax=new Tax($registry);} $registry->set('customer',$customer);$registry->set('tax',$tax);$this->customer=$customer;$this->tax=$tax;$this->patternsSettings=$this->ssb_data->getSetting('patternsSettings');} public function getCPBI_item($CPBI,$id_item){ $data_CPBI_item=$this->{'get_'.$CPBI}('',$id_item);return $data_CPBI_item;} public function getCPBI($CPBI,$categoryEntity='',$gen_pack_number=0,$internal_entity='',$only_empty=false){ $this->only_empty=$only_empty !==false ? true:$this->only_empty;if($this->only_empty){ echo 'getCPBI => '.$categoryEntity.'</br>';if($categoryEntity !='urls' AND $categoryEntity !='related_prod' AND $categoryEntity !='reviews' AND $categoryEntity !='images'){ $categoryEntites=$this->ssb_data->getMatadata('CategoryEntites');$this->empty_column=$categoryEntites[$categoryEntity]['column'];}elseif($categoryEntity=='urls'){ $this->empty_column='';}elseif($categoryEntity=='related_prod'){ $this->empty_column='';}elseif($categoryEntity=='reviews'){ $this->empty_column='';} } $data_CPBI=array();$time_start=microtime(true);$this->gen_pack_number=$gen_pack_number;if($CPBI=='CPBI_urls' AND $internal_entity==''){ $CPBI='all';}elseif($internal_entity !=''){ $CPBI=$internal_entity;} if($CPBI=='all'){ if($categoryEntity=='' OR $categoryEntity=='urls'){ $CPBIs=$this->ssb_data->getMatadata('CPBI',array('keys'=>true));}else{ $MD_entities=$this->ssb_data->getMatadata('Entites');$CPBIs=array_keys($MD_entities[$categoryEntity]);} $total=0;foreach($CPBIs as $CPBI_){ $data=$this->getCPBI($CPBI_,$categoryEntity,$gen_pack_number);$total+=$data['total'];$data_CPBI['data'][$CPBI_]=$data['data'];} $data_CPBI['total']=$total;$data_CPBI['name']='all';}else{ $gen_pack=$this->ssb_data->getGenPack($gen_pack_number,$CPBI,$categoryEntity);if($CPBI=='related_prod' OR $CPBI=='images' OR $categoryEntity=='images' OR $categoryEntity=='reviews'){ $CPBI='product';} $data_CPBI=$this->{'get_'.$CPBI}($gen_pack);} $this->ssb_data->getSpecialPatterns();if($this->only_empty){ } return $data_CPBI;} private function get_product($gen_limit='',$item_id=''){ $languages=$this->ssb_helper->getLanguages();$this->total=0;$respond=array();foreach ($languages as $l_code=> $l_data){ if(isset($_SESSION['gener_lang']) AND $_SESSION['gener_lang'] !=$l_code)continue;$respond_lang=$this->get_product_lang($l_data,$gen_limit,$item_id);$respond =array_replace_recursive ($respond,$respond_lang);} return array('data'=> $respond,'total'=> $this->total,'name'=> 'product');} private function get_product_lang($l_data,$gen_limit,$item_id){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];$sql="SELECT pd.title_image, pd.alt_image, pd.tag, pd.meta_description, pd.meta_keyword, pd.seo_title, pd.seo_h1, pd.seo_h2, pd.seo_h3, pd.meta_seo_data, p.product_id, p.tax_class_id, p.price, (SELECT price FROM ".DB_PREFIX2."product_special sp where sp.product_id = p.product_id limit 1) as sp_price, p.model, m.name as b_name, p.sku, p.upc, p.isbn, pd.name, p.image, pd.description, md.description as b_description FROM ".DB_PREFIX2."product_description pd    INNER JOIN ".DB_PREFIX2."product p on pd.product_id = p.product_id     LEFT  JOIN ".DB_PREFIX2."manufacturer m on m.manufacturer_id = p.manufacturer_id    LEFT  JOIN ".DB_PREFIX2."manufacturer_description md on m.manufacturer_id = md.manufacturer_id and md.language_id = ".$l_id ." WHERE  pd.language_id = ".$l_id;if($this->empty_column){ $sql.=" AND pd.".$this->empty_column."=''";} if($item_id !==''){ $sql.=" AND p.product_id =".$item_id.";";}else{ $sql.=" LIMIT ".(int)$gen_limit['start'].",".(int)$gen_limit['limit'].";";} $query=$this->db2->query($sql);$data_currency = isset($this->session->data['currency']) ? $this->session->data['currency'] : $this->config->get('config_currency');$products=array();foreach($query->rows as $product){ if(!isset($products [$product['product_id']][$l_code])){ $sql="SELECT cd.category_id as c_id, cd.name as c_name, cd.description as c_description FROM ".DB_PREFIX2."product_to_category pc       INNER  JOIN ".DB_PREFIX2."category_description cd on cd.category_id = pc.category_id and cd.language_id = ".(int)$l_data['language_id']."  WHERE pc.product_id = '" . $product['product_id'] . "';";$query_cat=$this->db2->query($sql);$categories=array('cn'=> array(),'c_id' => array(),'cd'=> array());foreach($query_cat->rows as $category){ $categories['cn'][] =$category['c_name'];$categories['c_id'][] =$category['c_id'];$categories['cd'][] =$category['c_description'];} if($this->patternsSettings['pp']['setting']['add_tax']){ $p_price=$this->currency->format($this->tax->calculate($product['price'],$product['tax_class_id'],$this->config->get('config_tax')),$data_currency);}else{ $p_price=$this->currency->format($product['price']);} if($this->patternsSettings['sp']['setting']['add_tax']){ if($product['sp_price']===NULL){ if($this->ssb_helper->getVerOC() >=22){ $p_sp_price=$this->currency->format($this->tax->calculate($product['price'],$product['tax_class_id'],$this->config->get('config_tax')),$data_currency);}else{ $p_sp_price=$this->currency->format($this->tax->calculate($product['price'],$product['tax_class_id'],$this->config->get('config_tax')));} }else{ if($this->ssb_helper->getVerOC() >=22){ $p_sp_price=$this->currency->format($product['price'],$data_currency);}else{ $p_sp_price=$this->currency->format($product['price']);} } }else{ if($this->ssb_helper->getVerOC() >=22){ $p_sp_price=$product['sp_price']===NULL ? $this->currency->format($product['price']):$this->currency->format($product['sp_price']);}else{ $p_sp_price=$product['sp_price']===NULL ? $this->currency->format($product['price']):$this->currency->format($product['sp_price']);} } $products [$product['product_id']][$l_code]=array( 'pn' => $product['name'],'pd' => $product['description'],'cn' => $categories['cn'],'c_id' => $categories['c_id'],'cd' => $categories['cd'],'bn' => $product['b_name'],'bd' => $product['b_description'],'pp' => $p_price,'sp' => $p_sp_price,'pm' => $product['model'],'ps' => $product['sku'],'pu' => $product['upc'],'pi' => $product['isbn'],'image' => $product['image'],'seo_field' => array( 'name' => $product['name'],'tags' => $product['tag'],'m_descrip' => $product['meta_description'],'m_keywords'=> $product['meta_keyword'],'titles' => $product['seo_title'],'seo_h1' => $product['seo_h1'],'seo_h2' => $product['seo_h2'],'seo_h3' => $product['seo_h3'],'descrip' => $product['description'],'alt_image' => $product['alt_image'],'title_image'=> $product['title_image'],'meta_seo_data'=> $product['meta_seo_data'] ) );$this->total++;} } return $products;} private function get_category($gen_limit='',$item_id=''){ $languages=$this->ssb_helper->getLanguages();$this->total=0;$respond=array();$this->totalProdFromCategory=array();foreach ($languages as $l_code=> $l_data){ if(isset($_SESSION['gener_lang']) AND $_SESSION['gener_lang'] !=$l_code)continue;$respond_lang=$this->get_category_lang($l_data,$gen_limit,$item_id);$respond =array_replace_recursive ($respond,$respond_lang);} return array('data'=> $respond,'total'=> $this->total,'name'=> 'category');} private function get_category_lang($l_data,$gen_limit,$item_id){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];$sql="SELECT c.parent_id, cd.tag, cd.title_image, cd.alt_image, cd.meta_description, cd.meta_keyword, cd.seo_title, cd.seo_h1, cd.seo_h2, cd.seo_h3, cd.meta_seo_data,  c.image as c_image, cd.category_id, cd.name, cd.description, cdp.name as parent_name FROM ".DB_PREFIX2."category c INNER JOIN ".DB_PREFIX2."category_description cd on c.category_id = cd.category_id LEFT  JOIN ".DB_PREFIX2."category_description cdp on (c.parent_id = cdp.category_id AND cdp.language_id = ".$l_id.") WHERE  cd.language_id = ".$l_id;if($this->empty_column){ $sql.=" AND cd.".$this->empty_column."=''";} if($item_id !==''){ $sql.=" AND c.category_id =".$item_id.";";}else{ $sql.=" LIMIT ".(int)$gen_limit['start'].",".(int)$gen_limit['limit'].";";} $query=$this->db2->query($sql);$categories=array();foreach($query->rows as $category){ if(!isset($categories[$category['category_id']][$l_code])){ if(!isset($this->totalProdFromCategory[$category['category_id']])){ $sql_total_prod="SELECT COUNT(product_id) as totalProd FROM ".DB_PREFIX2."product_to_category WHERE category_id = '". (int)$category['category_id'] ."';";$query_total=$this->db2->query($sql_total_prod);$this->totalProdFromCategory[$category['category_id']]=$query_total->rows[0]['totalProd'];if($this->totalProdFromCategory[$category['category_id']]==0){ $childrenCategory=array();$query_children=$this->db2->query("SELECT category_id FROM ".DB_PREFIX2."category WHERE parent_id = '" . (int)$category['category_id'] . "'");foreach ($query_children->rows as $category_children) { $sql_total_prod="SELECT COUNT(product_id) as totalProd FROM ".DB_PREFIX2."product_to_category WHERE category_id = '". (int)$category_children['category_id'] ."';";$query_total=$this->db2->query($sql_total_prod);$this->totalProdFromCategory[$category['category_id']]+=$query_total->rows[0]['totalProd'];} } } $query_children=isset($query_children) ? $query_children:$this->db2->query("SELECT category_id FROM ".DB_PREFIX2."category WHERE parent_id = '" . (int)$category['category_id'] . "'");$result_csd=array('cn'=> array(),'c_id' => array(),'cd'=> array());foreach ($query_children->rows as $category_children) { $sql="SELECT category_id, name, description FROM ".DB_PREFIX2."category_description  WHERE category_id = ".(int)$category_children['category_id']." AND language_id = ".$l_id;$query_csd=$this->db2->query($sql);if(isset($query_csd->rows[0])){ $result_csd['cn'][] =$query_csd->rows[0]['name'];$result_csd['c_id'][] =$query_csd->rows[0]['category_id'];$result_csd['cd'][] =$query_csd->rows[0]['description'];} } $ep_data=array( 'totalProduct' => $this->totalProdFromCategory[$category['category_id']],'CPBI' => 'category','id' => $category['category_id'],'l_id' => $l_id );$exampleProducts=$this->getExampleProducts($ep_data);$categories [$category['category_id']][$l_code]=array( 'cn' => $category['name'],'cd'=> $category['description'],'cp'=> !is_null($category['parent_name']) ? $category['parent_name']:'','csn'=> $result_csd['cn'],'csn_id'=> $result_csd['c_id'],'csd'=> $result_csd['cd'],'ep'=> $exampleProducts,'tp'=> $this->totalProdFromCategory[$category['category_id']],'image'=> $category['c_image'],'seo_field' => array( 'name' => $category['name'],'tags' => $category['tag'],'m_descrip' => $category['meta_description'],'m_keywords'=> $category['meta_keyword'],'titles' => $category['seo_title'],'seo_h1' => $category['seo_h1'],'seo_h2' => $category['seo_h2'],'seo_h3' => $category['seo_h3'],'descrip' => $category['description'],'alt_image' => $category['alt_image'],'title_image' => $category['title_image'],'meta_seo_data'=> $category['meta_seo_data'] ) );$this->total++;} } return $categories;} private function get_brand($gen_limit='',$item_id=''){ $languages=$this->ssb_helper->getLanguages();$this->total=0;$respond=array();foreach ($languages as $l_code=> $l_data){ if(isset($_SESSION['gener_lang']) AND $_SESSION['gener_lang'] !=$l_code)continue;$respond_lang=$this->get_brand_lang($l_data,$gen_limit,$item_id);$respond =array_replace_recursive ($respond,$respond_lang);} return array('data'=> $respond,'total'=> $this->total,'name'=> 'brand');} private function get_brand_lang($l_data,$gen_limit,$item_id){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];$sql="SELECT md.tag, md.meta_description, md.meta_keyword, md.seo_title, md.seo_h1, md.seo_h2, md.seo_h3, md.meta_seo_data, m.image, m.manufacturer_id, m.name, md.description FROM ".DB_PREFIX2."manufacturer m     LEFT JOIN ".DB_PREFIX2."manufacturer_description md on m.manufacturer_id = md.manufacturer_id";$where=false;$lang_count=count($this->ssb_helper->getLanguages());if($lang_count > 1){ $where=true;$sql.=" WHERE (md.language_id = ".$l_id." OR 1)";} if($this->empty_column){ $sql.=$where ? " AND md.".$this->empty_column."=''":" WHERE md.".$this->empty_column."=''";$where=true;} if($item_id !==''){ $sql.=$where ? " AND m.manufacturer_id =".$item_id.";":" WHERE m.manufacturer_id =".$item_id.";";}else{ $sql.=" LIMIT ".(int)$gen_limit['start'].",".(int)$gen_limit['limit'].";";} $query=$this->db2->query($sql);$brands=array();$totalProd=array();foreach($query->rows as $brand){ if(!isset($brands[$brand['manufacturer_id']][$l_code])){ if(!isset($totalProd[$brand['manufacturer_id']])){ $sql_total_prod="SELECT COUNT(product_id) as totalProd FROM ".DB_PREFIX2."product WHERE manufacturer_id = '". $brand['manufacturer_id'] ."';";$query_total=$this->db2->query($sql_total_prod);$totalProd[$brand['manufacturer_id']]=$query_total->rows[0]['totalProd'];} $ep_data=array( 'totalProduct' => $totalProd[$brand['manufacturer_id']],'CPBI' => 'brand','id' => $brand['manufacturer_id'],'l_id' => $l_id );$exampleProducts=$this->getExampleProducts($ep_data);$brands[$brand['manufacturer_id']][$l_code]=array( 'bn' => $brand['name'],'bd'=> isset($brand['description']) ? $brand['description']:'','ep'=> $exampleProducts,'tp'=> $totalProd[$brand['manufacturer_id']],'image'=> $brand['image'],'seo_field' => array( 'name' => $brand['name'],'tags' => isset($brand['tag']) ? $brand['tag']:'','m_descrip'=> isset($brand['meta_description']) ? $brand['meta_description']:'','m_keywords'=> isset($brand['meta_keyword']) ? $brand['meta_keyword']:'','titles' => isset($brand['seo_title']) ? $brand['seo_title']:'','seo_h1' => isset($brand['seo_h1']) ? $brand['seo_h1']:'','seo_h2' => isset($brand['seo_h2']) ? $brand['seo_h2']:'','seo_h3' => isset($brand['seo_h3']) ? $brand['seo_h3']:'','descrip' => isset($brand['description']) ? $brand['description']:'','meta_seo_data'=> isset($brand['meta_seo_data']) ? $brand['meta_seo_data']:'' ) );$this->total++;} } return $brands;} private function get_info($gen_limit='',$item_id=''){ $languages=$this->ssb_helper->getLanguages();$this->total=0;$respond=array();foreach ($languages as $l_code=> $l_data){ if(isset($_SESSION['gener_lang']) AND $_SESSION['gener_lang'] !=$l_code)continue;$respond_lang=$this->get_info_lang($l_data,$gen_limit,$item_id);$respond =array_replace_recursive ($respond,$respond_lang);} return array('data'=> $respond,'total'=> $this->total,'name'=>'information');} private function get_info_lang($l_data,$gen_limit,$item_id){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];$sql="SELECT id.tag, id.meta_description, id.meta_keyword, id.seo_title, id.information_id, id.title as name, id.description, id.meta_seo_data FROM ".DB_PREFIX2."information_description id WHERE id.language_id = ".$l_id;if($this->empty_column){ $sql.=" AND id.".$this->empty_column."=''";} if($item_id !==''){ $sql.=" AND id.information_id =".$item_id.";";}else{ $sql.=" LIMIT ".(int)$gen_limit['start'].",".(int)$gen_limit['limit'].";";} $query=$this->db2->query($sql);$infos=array();foreach($query->rows as $info){ if(!isset($infos[$info['information_id']][$l_code])){ $infos[$info['information_id']][$l_code]=array( 'in' => $info['name'],'id'=> $info['description'],'seo_field' => array( 'name' => $info['name'],'tags' => $info['tag'],'m_descrip'=> $info['meta_description'],'m_keywords'=> $info['meta_keyword'],'titles' => $info['seo_title'],'descrip' => $info['description'],'meta_seo_data'=> $info['meta_seo_data'] ) );$this->total++;} } return $infos;} private function get_CPBI_urls(){ return $this->getCPBI('all','',$this->gen_pack_number);} private function get_STAN_urls(){ return array('data'=> array(),'total'=> 0,'name'=> 'STAN_urls');} private function get_related_prod(){ return $this->getCPBI('product','',$this->gen_pack_number);} public function delCPBI_Cache($CPBI='all'){ if ($CPBI !='all'){ $this->cache->delete('ssb.CPBI.'.$CPBI);}else{ $CPBIs=$this->ssb_data->getMatadata('CPBI',array('keys'=>true));foreach($CPBIs as $val){ $this->cache->delete('ssb.CPBI.'.$val);} } } public function getCountries($continent_code='') { if(!$continent_code){ $sql="SELECT c.name as name, c.code FROM ".DB_PREFIX2."wc_countries c ORDER BY c.name";} else{ $sql="SELECT c.name as name, c.code FROM ".DB_PREFIX2."wc_countries c WHERE continent_code = '". $continent_code ."' ORDER BY c.name";} $query=$this->db2->query($sql);return $query->rows;} public function getContinents() { $sql="SELECT name, code, geonameId FROM ".DB_PREFIX2."wc_continents c ORDER BY c.name";$query=$this->db2->query($sql);return $query->rows;} public function getTotalSEOField($data,$all=false) { $page=isset($data['page']) ? (int)$data['page']:1;$page=$page==0 ? 1:$page;$data['start']=($page-1) * 20;$data['limit']=20;$this->load->model('tool/image');$func='getTotalSEOField_'.$data['type'];if(isset($data['need_language_id'])){ $l_id=$data['need_language_id'];}else{ $l_id='';} $respond=$this->$func($data,$all,$l_id);if(!count($respond['content']) AND isset($data['filter_name']) AND $data['filter_name']){ $languages=$this->ssb_helper->getLanguages();$defaultLanguge=$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());foreach ($languages as $l_code=> $l_data){ $l_code=$l_data['code'];$l_id =$l_data['language_id'];if($l_id !=$defaultLanguge){ $respond=$this->$func($data,$all,$l_id);} if(count($respond['content'])){ $respond['need_language_id']=$l_id;break;} } } if($data['type']=='home' OR $data['type']=='standardPage'){ }else{ $type=$data['type']=='brand' ? 'manufacturer':$data['type'];$type=$data['type']=='info' ? 'information':$type;$this->load->model('catalog/'.$type);$model_catalog_type='model_catalog_'.$type;$func_pag = $respond['pagination'];$item_total = $this->$model_catalog_type->$func_pag($data);$pagination=$this->getPaginationPrepare($item_total,$data,$data['type']);$respond['pagination']=$pagination;} return $respond;} private function getTotalSEOField_home($data,$all,$defaultLanguge=''){ } private function getTotalSEOField_standardPage($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT * FROM ".DB_PREFIX2."url_alias WHERE  auto_gen = 'STAN_urls' AND language_id = ".$defaultLanguge;$query=$this->db2->query($sql);foreach ($query->rows as $result) { $language_data=array( 'query' => $result['query'],'keyword' => $result['keyword'] );$respond[$result['url_alias_id']]['data'][$result['language_id']]=$language_data;} return array('content'=> $respond,'pagination'=> '');} private function getTotalSEOField_product($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT p.image, pd.product_id, pd.name, pd.tag, pd.meta_description, pd.meta_keyword, pd.seo_title, pd.seo_h1,  pd.seo_h2, pd.seo_h3, pd.description, pd.language_id FROM ".DB_PREFIX2."product_description pd INNER JOIN ".DB_PREFIX2."product p ON p.product_id = pd.product_id WHERE  pd.language_id = ".$defaultLanguge;$sql=$this->getSQLPrepare("p.status","pd.name",$data,$sql);$query=$this->db2->query($sql);foreach($query->rows as $result){ $language_data=array( 'name' => $result['name'],'tags' => $result['tag'],'m_descrip'=> $result['meta_description'],'m_keywords'=> $result['meta_keyword'],'titles' => $result['seo_title'],'seo_h1' => $result['seo_h1'],'seo_h2' => $result['seo_h2'],'seo_h3' => $result['seo_h3'],'descrip' => $result['description'],'urls' => $this->getKeyword('product_id='.$result['product_id'],$defaultLanguge) );if(!isset($respond[$result['product_id']]['related'])){ $sql="SELECT pd.name, pr.related_id FROM ".DB_PREFIX2."product_related pr INNER JOIN ".DB_PREFIX2."product_description pd ON (pd.product_id = pr.related_id AND pd.language_id = ".$defaultLanguge." ) WHERE pr.product_id = '" . $result['product_id'] . "';";$query_related=$this->db2->query($sql);$product_related_data=array();$related_onlyId=array();foreach ($query_related->rows as $result_r) { $related_onlyId[]=(int)$result_r['related_id'];$product_related_data[]=array( 'related_id'=> (int)$result_r['related_id'],'name'=> $result_r['name'],'id'=> (int)$result_r['related_id'],'text'=> $result_r['name'],);} $respond[$result['product_id']]['related']=$product_related_data;$respond[$result['product_id']]['related_onlyId']=$related_onlyId;} $respond[$result['product_id']]['data'][$result['language_id']]=$language_data;if ($result['image'] && file_exists(DIR_IMAGE.$result['image'])) { $image=$this->model_tool_image->resize($result['image'],60,60);} else { $image=$this->model_tool_image->resize('no_image.jpg',60,60);} $respond[$result['product_id']]['image']=$image;} return array('content'=> $respond,'pagination'=> 'getTotalProducts');} private function getTotalSEOField_category($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT c.image, cd.category_id, cd.name, cd.tag, cd.meta_description, cd.meta_keyword, cd.seo_title, cd.seo_h1, cd.seo_h2, cd.seo_h3, cd.description, cd.language_id FROM ".DB_PREFIX2."category_description cd INNER JOIN ".DB_PREFIX2."category c ON c.category_id = cd.category_id WHERE  cd.language_id = ".$defaultLanguge;$sql=$this->getSQLPrepare("c.status","cd.name",$data,$sql);$query=$this->db2->query($sql);foreach ($query->rows as $result) { $language_data=array( 'name' => $result['name'],'tags' => $result['tag'],'m_descrip'=> $result['meta_description'],'m_keywords'=> $result['meta_keyword'],'titles' => $result['seo_title'],'seo_h1' => $result['seo_h1'],'seo_h2' => $result['seo_h2'],'seo_h3' => $result['seo_h3'],'descrip' => $result['description'],'urls' => $this->getKeyword('category_id='.$result['category_id'],$defaultLanguge) );$respond[$result['category_id']]['data'][$result['language_id']]=$language_data;if ($result['image'] && file_exists(DIR_IMAGE.$result['image'])) { $image=$this->model_tool_image->resize($result['image'],60,60);} else { $image=$this->model_tool_image->resize('no_image.jpg',60,60);} $respond[$result['category_id']]['image']=$image;} return array('content'=> $respond,'pagination'=> 'getTotalCategories');} private function getTotalSEOField_brand($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT m.image, m.manufacturer_id, m.name, md.tag, md.meta_description, md.meta_keyword, md.seo_title, md.seo_h1,  md.seo_h2, md.seo_h3, md.description, md.language_id FROM ".DB_PREFIX2."manufacturer_description md INNER JOIN ".DB_PREFIX2."manufacturer m ON m.manufacturer_id = md.manufacturer_id WHERE  md.language_id = ".$defaultLanguge;$sql=$this->getSQLPrepare("","m.name",$data,$sql);$query=$this->db2->query($sql);foreach ($query->rows as $result) { $language_data=array( 'name' => $result['name'],'tags' => isset($result['tag']) ? $result['tag']:'','m_descrip'=> isset($result['meta_description']) ? $result['meta_description']:'','m_keywords'=> isset($result['meta_keyword']) ? $result['meta_keyword']:'','titles' => isset($result['seo_title']) ? $result['seo_title']:'','seo_h1' => isset($result['seo_h1']) ? $result['seo_h1']:'','seo_h2' => isset($result['seo_h2']) ? $result['seo_h2']:'','seo_h3' => isset($result['seo_h3']) ? $result['seo_h3']:'','descrip' => isset($result['description']) ? $result['description']:'','urls' => $this->getKeyword('manufacturer_id='.$result['manufacturer_id'],$defaultLanguge) );$respond[$result['manufacturer_id']]['data'][$defaultLanguge]=$language_data;if ($result['image'] && file_exists(DIR_IMAGE.$result['image'])) { $image=$this->model_tool_image->resize($result['image'],60,60);} else { $image=$this->model_tool_image->resize('no_image.jpg',60,60);} $respond[$result['manufacturer_id']]['image']=$image;} return array('content'=> $respond,'pagination'=> 'getTotalManufacturers');} private function getTotalSEOField_info($data,$all,$defaultLanguge=''){ $defaultLanguge=$defaultLanguge!='' ? $defaultLanguge:$this->ssb_helper->getLang_Code_Id($this->ssb_helper->getDefaultLanguage());$respond=array();$sql="SELECT id.information_id, id.title, id.seo_title, id.tag, id.meta_description, id.meta_keyword,  id.description, id.language_id FROM ".DB_PREFIX2."information_description id INNER JOIN ".DB_PREFIX2."information i ON i.information_id = id.information_id WHERE  id.language_id = ".$defaultLanguge;$sql=$this->getSQLPrepare("i.status","id.title",$data,$sql);$query=$this->db2->query($sql);foreach ($query->rows as $result) { $language_data=array( 'name' => $result['title'],'tags' => $result['tag'],'m_descrip'=> $result['meta_description'],'m_keywords'=> $result['meta_keyword'],'titles' => $result['seo_title'],'urls' => $this->getKeyword('information_id='.$result['information_id'],$defaultLanguge) );$respond[$result['information_id']]['data'][$result['language_id']]=$language_data;} return array('content'=> $respond,'pagination'=> 'getTotalInformations');} private function getSQLPrepare($status='',$d_name,$data,$sql){ if (isset($data['filter_name'])) { $sql.=" AND ".$d_name." LIKE '%" . $this->db2->escape($data['filter_name']) . "%'";} if($status){ $sql.=" AND ".$status." = 1";} $sql.=" ORDER BY ".$d_name;if (isset($data['order']) && ($data['order']=='DESC')) { $sql.=" DESC";} else { $sql.=" ASC";} $sql.=" LIMIT ".(int)$data['start'].",".(int)$data['limit'];return $sql;} private function getPaginationPrepare($item_total,$data,$type){ $l_data=$this->language->load('module/superseobox');$url='&metaData[action]=getGenEditorContent&data[type]='.$data['type'];if (isset($data['order'])) { $url.='&data[order]='.$data['order'];} if (isset($data['filter_name'])) { $url.='&data[filter_name]='.urlencode(html_entity_decode($data['filter_name'],ENT_QUOTES,'UTF-8'));} if (isset($data['page'])) { $page=$data['page'];} else { $page=1;} $pagination =new Pagination();$pagination->total =$item_total;$pagination->page =$page;$pagination->limit =20;$pagination->text =$l_data['pagination_text'];$pagination->url =$this->url->link('module/superseobox/ajax','token='.$this->session->data['token'].$url.'&data[page]={page}','SSL');$pagination=$pagination->render();return $pagination;} public function saveGenEditorContent($data){ if(isset($data['del_array'])){ foreach($data['del_array'] as $id){ $this->db2->query("DELETE FROM ".DB_PREFIX2."url_alias WHERE url_alias_id = '" . (int)$id . "'");} return true;} $item_id=$data['item_id'];$data['item_type']=$data['item_type']=='brand' ? 'manufacturer':$data['item_type'];$data['table']=$data['item_type']=='standardPage' ? 'standardPage':$data['table'];$data['item_type']=$data['item_type']=='info' ? 'information':$data['item_type'];if($data['item_type']=='manufacturer' AND $data['column']=='name'){ $data['table']='manufacturer';} if($data['item_type']=='information' AND $data['column']=='name'){ $data['column']='title';} switch ($data['table']) { case 'url_alias':$query=$data['item_type'].'_id='.$item_id;$check=$this->db2->query("SELECT * FROM ".DB_PREFIX2."url_alias WHERE query = '" . $query . "' AND language_id = ".$data['lang_id'].";");if(count($check->rows)){ $sql="UPDATE ".DB_PREFIX2."url_alias SET keyword = '" .  $this->db2->escape($data['value']) . "' WHERE query = '" . $query . "' AND language_id = ".$data['lang_id'].";";}else{ $sql="INSERT INTO ".DB_PREFIX2."url_alias SET keyword = '" . $this->db2->escape($data['value']) . "', query = '" . $query . "', auto_gen = 'CPBI_urls', language_id = ".$data['lang_id'].";";} break;case 'product_related':echo 'product_related';break;case 'home':echo 'home';break;case 'standardPage':$col_id_name='url_alias_id';if($item_id !=''){ $sql="UPDATE ".DB_PREFIX2."url_alias SET ".$data['column']." = '" .  $this->db2->escape($data['value']) . "' WHERE ".$col_id_name." = '" . $item_id . "' AND language_id = ".$data['lang_id'].";";}else{ $sql="INSERT INTO ".DB_PREFIX2."url_alias SET ".$data['column']." = '" .  $this->db2->escape($data['value']) . "', auto_gen = 'STAN_urls', language_id = ".$data['lang_id'].";";} break;default:if($data['item_type']=='manufacturer' AND $data['column']=='name'){ $col_id_name='manufacturer_id';$sql="UPDATE ".DB_PREFIX2.$data['table']." SET ".$data['column']." = '" .  $this->db2->escape($data['value']) . "' WHERE ".$col_id_name." = '" . $item_id . "';";}else{ $col_id_name=$data['item_type'].'_id';$sql="UPDATE ".DB_PREFIX2.$data['table']." SET ".$data['column']." = '" .  $this->db2->escape($data['value']) . "' WHERE ".$col_id_name." = '" . $item_id . "' AND language_id = ".$data['lang_id'].";";} } $this->db2->query($sql);return $this->db2->getLastId();} private function saveGenEditorContent_product($data){ $item_id=$data['item_id'];return true;} private function saveGenEditorContent_category($data){ $item_id=$data['item_id'];$this->saveToDescripUrlTable('category_id','category_description',$data,$item_id);return true;} private function saveGenEditorContent_brand($data){ $item_id=$data['item_id'];$this->saveToDescripUrlTable('manufacturer_id','manufacturer_description',$data,$item_id);return true;} private function saveGenEditorContent_info($data){ $item_id=$data['item_id'];$d_name='information_id';$table='information_description';foreach($data['content'] as $lang_id=> $content){ $tag =$this->db2->escape($content['tag']);$m_keyword =$this->db2->escape($content['meta_keyword']);$m_description =$this->db2->escape($content['meta_description']);$title =$this->db2->escape($content['title']);$description=$this->db2->escape($content['description']);$sql="UPDATE ".DB_PREFIX2.$table." SET tag = '". $tag  ."', meta_keyword = '". $m_keyword ."', meta_description = '". $m_description ."', seo_title = '". $title ."' WHERE ".$d_name." = ".$item_id." AND language_id = ".$lang_id.";";$query=$this->db2->query($sql);$keyword =$content['keyword'];if($keyword <> ''){ $sql="UPDATE ".DB_PREFIX2."url_alias SET keyword = '". $keyword ."' WHERE query = '".$d_name."=". $item_id ."' AND language_id = ".$lang_id.";";$query=$this->db2->query($sql);} } return true;} private function saveToDescripUrlTable($d_name,$table,$data,$item_id){ foreach($data['content'] as $lang_id=> $content){ $tag =$this->db2->escape($content['tag']);$m_keyword =$this->db2->escape($content['meta_keyword']);$m_description =$this->db2->escape($content['meta_description']);$title =$this->db2->escape($content['title']);$description=$this->db2->escape($content['description']);$seo_h1 =$this->db2->escape($content['seo_h1']);$seo_h2 =$this->db2->escape($content['seo_h2']);$seo_h3 =$this->db2->escape($content['seo_h3']);$sql="UPDATE ".DB_PREFIX2.$table." SET tag = '". $tag  ."', meta_keyword = '". $m_keyword ."', meta_description = '". $m_description ."', seo_title = '". $title ."', description = '". $description ."', seo_h1 = '". $seo_h1 ."', seo_h2 = '". $seo_h2 ."', seo_h3 = '". $seo_h3 ."' WHERE ".$d_name." = ".$item_id." AND language_id = ".$lang_id.";";$query=$this->db2->query($sql);$keyword =$content['keyword'];if($keyword <> ''){ $sql="UPDATE ".DB_PREFIX2."url_alias SET keyword = '". $keyword ."' WHERE query = '".$d_name."=". $item_id ."' AND language_id = ".$lang_id.";";$query=$this->db2->query($sql);} } } private function getExampleProducts($data,$get_total=9){ $query_prods=array();if( $data['totalProduct']==0)return $query_prods;if($data['CPBI']=='category'){ $sql_start="SELECT pd.name FROM ".DB_PREFIX2."product_description pd       LEFT JOIN ".DB_PREFIX2."product_to_category pc ON pc.product_id = pd.product_id      WHERE pc.category_id = '".$data['id']."' AND pd.language_id = '". $data['l_id'];    }else{     $sql_start = "SELECT pd.name FROM ". DB_PREFIX2 ."product p       LEFT JOIN ". DB_PREFIX2 ."product_description pd ON pd.product_id = p.product_id      WHERE p.manufacturer_id = '".$data['id']."' AND pd.language_id = '".$data['l_id'];} if($data['totalProduct'] > $get_total){ $rand_prod=rand(0,$data['totalProduct']-$get_total);}else{ $rand_prod=0;} $sql_finish="' LIMIT ". $rand_prod .", ". $get_total .";";    $sql_prod = $sql_start . $sql_finish;    $query_prod = $this->db2->query($sql_prod);    foreach($query_prod->rows as $row){     $query_prods[] = $row['name'];    }    return $query_prods;   }   private function getSentences($text , $count) {    $text = strip_tags(html_entity_decode($text));    $pos = 0;    $found = false;    for ($x=0; $x<=$count; $x++)    {     $pos = strpos($text, '.', 0);     if($pos !== false){      $found = true;     }    }    if($found){     if($pos === false) {      return $text;     }else{      return substr($text, 0, $pos+1);     }    }   }   private function getKeyword($query_string, $language_id){    $result_= '';    $sql_ = "SELECT * FROM " . DB_PREFIX2 . "url_alias WHERE query='".$query_string."' AND language_id = " . $language_id;    $query_ = $this->db2->query($sql_);    if(count($query_->rows)){     $result_ = $query_->rows[0]['keyword'];    }else{     $sql_ = "SELECT * FROM " . DB_PREFIX2 . "url_alias WHERE query='".$query_string."';";     $query_ = $this->db2->query($sql_);     if(count($query_->rows))$result_ = $query_->rows[0]['keyword'];    }    return $result_;   }  }  if (!function_exists('array_replace_recursive'))  {    function array_replace_recursive($array, $array1)    {      $args = func_get_args();      $array = $args[0];      if (!is_array($array))      {        return $array;      }      for ($i = 1; $i < count($args); $i++)      {        if (is_array($args[$i]))        {          $array = recurse($array, $args[$i]);        }      }      return $array;    }    function recurse($array, $array1)      {        foreach ($array1 as $key => $value)        {          if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key])))          {            $array[$key] = array();          }          if (is_array($value))          {            $value = recurse($array[$key], $value);          }          $array[$key] = $value;        }        return $array;      }  }  ?>

Function Calls

None

Variables

None

Stats

MD5 3d0be99be407e843b93ee8d354dd4c93
Eval Count 0
Decode Time 248 ms