/* Decoded by unphp.net */ ?>host = $host; $this->username = $username; $this->password = $password; $this->dbname = $dbname; parent::__construct( $this->host, $this->username, $this->password, $this->dbname ); } /** * #### Đặt giá trị tag * * * @param string $getUrl * * @param int $catId * * @param string $valueGet * * @return void */ public function metaTags($getUrl='', $catId, $valueGet) { $_data = ''; $_table = 'tbl_cat'; if ( empty($getUrl) ) { # Lay tieu de danh muc if ( !empty($catId) ) { $this->where("id", $catId); } else { $this->where("url", ''); } $valueGet = 'name'; } else { $_table = "tbl_prod"; $this->where("url", hn_get('url')); } $_data = $this->getValue($_table, $valueGet); if ( $valueGet == 'url' ) { if ( empty($getUrl) ) { $_data = ROOT_PATH . $_data ."/"; } else { $this->where("id", $catId); $$models->urlCat = $this->getValue("tbl_cat", "url"); $_data = ROOT_PATH.$$models->urlCat."/".$_data.".html"; } } if ( $valueGet == 'image' && !empty($catId) ) { if ( empty($getUrl) ) { $_data = ''; } else { $_data = ROOT_PATH."uploads/product/".$_data; } } return $_data; } /** * ### Lấy nhanh thông tin (echo) * * * @param string $keyname * * @return void */ public function getThongTin($keyname) { $this->where("keyname = '".$keyname."'"); echo $this->getValue("tbl_info", "content"); } /** * ### Lấy nhanh thông tin (return) * * * @param string $keyname * * @return void */ public function thongTin($keyname) { $this->where("keyname = '".$keyname."'"); return $this->getValue("tbl_info", "content"); } public function urlCat($idcat) { $this->where('id', $idcat); return $this->getValue("tbl_cat", "url"); } /** * ### Lấy nhanh các sản phẩm * * * @param array $data * * @param int $idparent * * @return void */ public function getProduct($data,$idparent) { if ( count($data) > 0 ) { # get url parent if ( !$idparent ) { # code... exit(); } $this->where('id', $idparent); $urlParent = $this->getValue("tbl_cat", "url"); $this->where("id", $idparent); $typeNw = $this->getValue("tbl_cat", "type"); if ( $typeNw == 1 ) { $dirImg = "news"; } else { $dirImg = "product"; } foreach ($data as $kpd => $vpd) { $url = $vpd['url'] ? ROOT_PATH.$urlParent.'/'.$vpd['url'].'.html' : '#'; $des = $vpd['des'] ? substr_word($vpd['des'], 90).'...' : null; echo '
'; } } } /** * ### Xóa hình tạm * * * @param string $table * * @param string $link * * @return void */ public function cleanImageTmp($table, $link) { $this->where("tmp", 1); $tmps =$this->get($table, null,array("id, images")); foreach ($tmps as $imgtmp) { if ( file_exists($link.$imgtmp['images']) ) { unlink($link.$imgtmp['images']); $this->where("id", $imgtmp['id']); $this->delete("tbl_prod_img"); } } } /** * ### Hàm sắp xếp * * * @param string $table * * @return void */ public function _sort($table) { $maxSort = (int) $this->getValue($table, "count(sort)"); if ( !!$maxSort ) { $maxSort = ($maxSort + 1); } else { $maxSort = 1; } return $maxSort; } } ?>