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; } } }