public function preDispatch() { $facebook = new Ishali_Facebook(); $store = App_Models_StoreModel::getInstance(); $this->_SESSION = new Zend_Session_Namespace(); //$facebook->getuserfbid(); if ($facebook->getpageid() != "") { @($idpage = $facebook->getpageid()); $_SESSION['idpage'] = $idpage; $this->_SESSION->idpage = $idpage; $this->view->idpage = $idpage; } else { $idpage = isset($_SESSION['idpage']) ? $_SESSION['idpage'] : ""; $this->view->idpage = $idpage; } if ($this->_request->getParam("idpage") != "") { $idpage = $this->_request->getParam("idpage"); $_SESSION['idpage'] = $idpage; $this->_SESSION->idpage = $idpage; $this->view->idpage = $idpage; } /* $idpage = '356730004423499'; $_SESSION['idpage'] = $idpage; $this->view->idpage = $idpage; */ if (isset($_GET['tabs_added'])) { $tabs_added = $_GET['tabs_added']; foreach ($tabs_added as $idpage => $status) { $link = ROOT_DOMAIN . '/admin?pg=' . $idpage; } echo "<script>top.location.href = '{$link}'</script>"; exit; } if (!$idpage) { $link = ROOT_DOMAIN . '/admin'; echo "<script>top.location.href = '{$link}'</script>"; exit; } //Khi link có app_data if ($facebook->getParameterUrl() != null) { $idsp = $facebook->getParameterUrl(); $idsp = base64_decode($idsp); $link = APP_DOMAIN . "/detail?idpage={$idpage}&id={$idsp}"; //echo "<script>showMessageNotClose('Ðang chuyển trang, vui lòng đợi',5000);</script>"; echo "<script>setTimeout(function(){window.location = '{$link}'},3000);</script>"; } $config = $store->getConfig($idpage); $this->view->config = $config; $template = $config['template'] != "" ? $config['template'] : 'bookshop'; $option = array('layout' => 'layout', 'layoutPath' => LAYOUT_PATH . '/' . $template); Zend_Layout::startMvc($option); }
public function indexAction() { $fb = new Ishali_Facebook(); $pageLike = App_Models_PagelikeModel::getInstance(); $config = Zend_Registry::get(APPLICATION_CONFIG); if ($fb->getParameterUrl() == "") { $idnoidung = ""; } else { $idnoidung = $fb->getParameterUrl(); } $checkLike = $fb->kiemTraLike(); //$checkLike = 1; if ($checkLike == "") { $link = APP_DOMAIN . '/index/yeucaulike'; header("location: {$link}"); } else { $idUserFB = $_SESSION['idUserFB']; $soLuotLike = $pageLike->kiemTraSoLuongLikeUser($idUserFB); $data = $pageLike->getConfig(); $solanlike = $data['solanlike']; if ($soLuotLike < $solanlike) { $appId = $config->facebook->appid; $data = $pageLike->getPageLike(); if ($data != "") { for ($i = 0; $i < count($data); $i++) { $idpage = $data[$i]['idpage']; $likePage = $fb->checkLikePage($idpage); if ($likePage == 0) { $linkAppPage = $data[$i]['linkpage'] . '/app_' . $appId . '?app_data=' . $idnoidung; $this->view->linkAppPage = $linkAppPage; return; } } //Truong hop Page nao cung da like $this->view->linkAppPage = ""; $linkNoiDung = $pageLike->getLinkNoiDung($idnoidung); $this->view->linkNoiDung = $linkNoiDung; } else { $this->view->linkAppPage = ""; $linkNoiDung = $pageLike->getLinkNoiDung($idnoidung); $this->view->linkNoiDung = $linkNoiDung; } } else { $this->view->linkAppPage = ""; $linkNoiDung = $pageLike->getLinkNoiDung($idnoidung); $this->view->linkNoiDung = $linkNoiDung; } } }
public function indexAction() { $facebook = new Ishali_Facebook(); if ($facebook->getParameterUrl() != null) { $idPD = $facebook->getParameterUrl(); $host = APP_DOMAIN; header("location: {$host}/product?idPD={$idPD}"); } $idpage = $_SESSION['idpage']; $daugia = $this->view->info = App_Models_DaugiaModel::getInstance(); $ShowAllPhienDau = $daugia->ShowAllPhienDau($idpage); $this->view->ShowAllPhienDau = $ShowAllPhienDau; $sql = "Select baiviet From ishali_bid_baiviet where idbv = 4 and idpage = '" . $idpage . "'"; $data = $daugia->ThucThiTruyVan($sql); if (count($data) > 0) { $this->view->tinthongbao = $data[0]["baiviet"]; } else { $this->view->tinthongbao = ""; } }
public function indexAction() { $store = $this->view->info = App_Models_StoreModel::getInstance(); $facebook = new Ishali_Facebook(); if ($facebook->getParameterUrl() != null) { $param = $facebook->getParameterUrl(); $data = explode('-', $param); $id = $data[0]; $sp = $data[1]; $host = APP_DOMAIN; header("location: {$host}/product?id={$id}&sp={$sp}"); //http://localhost/appfb/ishalistore/product?id=Mg==&sp=MTg= } //356730004423499 //$idpage = $_SESSION['idpage']; //$this->view->idpage = $idpage; if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") { $idpage = $_SESSION['idpage']; $this->view->idpage = $idpage; } else { //$idpage = $_GET["idpage"]; $idpage = $this->_request->getParam("idpage"); $this->view->idpage = $idpage; } $sql = "select count(*) as tongsp "; $sql .= "from ishali_sanpham "; $sql .= "where anhien = 1 and showindex=1 and idpage = " . $idpage; $data = $store->SelectQuery($sql); $tongsp = $data[0]['tongsp']; $sp1trang = 12; if ($tongsp > $sp1trang) { $sotrang = ceil($tongsp / $sp1trang); if ($this->_request->getParam("page") == "") { $sql = "Select idsp, masp, idloaisp, tensp, gia, hinhchinh "; $sql .= "from ishali_sanpham "; $sql .= "where showindex = 1 and anhien = 1 and idpage = " . $idpage . " order by ngaycapnhat desc "; $sql .= "limit 0," . $sp1trang; $data = $store->SelectQuery($sql); $this->view->showsp = $data; } else { $npage = base64_decode($this->_request->getParam("page")); $sp_start = $sp1trang * ($npage - 1); $sql = "Select idsp, masp, idloaisp, tensp, gia, hinhchinh "; $sql .= "from ishali_sanpham "; $sql .= "where showindex = 1 and anhien = 1 and idpage = " . $idpage . " order by ngaycapnhat desc "; $sql .= "limit " . $sp_start . "," . $sp1trang; $data = $store->SelectQuery($sql); $this->view->showsp = $data; } $this->view->sotrang = $sotrang; } else { $sql = "Select idsp, masp, idloaisp, tensp, gia, hinhchinh "; $sql .= "from ishali_sanpham "; $sql .= "where (showindex = 1 || ngaycapnhat < now()) and anhien = 1 and idpage = " . $idpage . " order by ngaycapnhat desc "; $sql .= "limit 0,12"; $data = $store->SelectQuery($sql); $this->view->showsp = $data; } $sql = "select donvitien from ishali_config where idpage = '" . $idpage . "'"; $data = $store->SelectQuery($sql); if (count($data) == 0) { $donvitien = "VNĐ"; } else { if ($data[0]['donvitien'] == "") { $donvitien = "VNĐ"; } else { $donvitien = $data[0]['donvitien']; } } $this->view->donvitien = $donvitien; }