public function xulyaddAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout->disableLayout();
     $store = $this->view->info = App_Models_StoreModel::getInstance();
     $facebook = new Ishali_Facebook();
     $iduser_fb = $facebook->getuserfbid();
     $idpage = $_SESSION['idpage'];
     if ($store->checkUserManagerPage($iduser_fb, $idpage)) {
         $Tenlsp = $_POST["tenlsp"];
         $Vitri = $_POST["vitri"];
         $Anhien = $_POST["anhien"];
         $parent_id = $_POST["parent_id"];
         $sql = "Insert into ishali_loaisp(tenloaisp, vitri, anhien, idpage, parent_id) ";
         $sql .= "Values ('" . $Tenlsp . "', '" . $Vitri . "', '" . $Anhien . "', '" . $idpage . "', '" . $parent_id . "')";
         $rs = mysql_query($sql);
         if ($rs) {
             echo 1;
             $id = mysql_insert_id();
             //Kiem tra xem neu dem bang 1 thi tiep tuc kiem tra co san pham nao thuoc danh muc nay ko, neu co thi chuyen san pham ve danh muc moi them
             $sql = "select count(*) as count_child_cat from ishali_loaisp where parent_id = {$parent_id}";
             $data = $store->SelectQuery($sql);
             $count = $data[0]['count_child_cat'];
             if ($count == 1) {
                 $sql = "update ishali_sanpham set idloaisp = '{$id}' where idloaisp = '{$parent_id}' and idpage = '{$idpage}'";
                 $store->InsertDeleteUpdateQuery($sql);
             }
         } else {
             echo 0;
         }
     } else {
         echo -1;
     }
 }
 public function indexAction()
 {
     $facebook = new Ishali_Facebook();
     $iduser_fb = $facebook->getuserfbid();
     $this->view->iduser_fb = $iduser_fb;
     $_SESSION['list_page'] = "0";
 }
 public function indexAction()
 {
     $facebookadmin = new Ishali_FacebookAdmin();
     $facebook = new Ishali_Facebook();
     $facebook->begins_works('1');
     $manage_pages = $facebookadmin->checkpermissions('manage_pages');
     if ($manage_pages) {
         $this->view->appid = $facebook->getAppId();
         $this->view->fbuserid = $facebook->getuserfbid();
         //		$this->view->list_pages = $facebookadmin->list_pages($this->view->fbuserid, 'page');
         $request = $this->getRequest();
         $this->view->curr_page = $request->getParam('search_page', 1);
         $this->view->count = 45;
         $result = App_Models_IshaliModel::getInstance()->getList($this->view->curr_page, $this->view->count);
         $this->view->total = $result['total'];
         @($this->view->pageslist = $result['data']);
         $paging = array();
         $paging['totalRecord'] = $result['total'];
         $paging['currentPage'] = $this->view->curr_page;
         $paging['numDisplay'] = 5;
         $paging['pageSize'] = $this->view->count;
         $paging['action'] = APP_DOMAIN . '/ishali';
         $this->view->paging = json_encode($paging);
     } else {
         $facebookadmin->install();
     }
 }
예제 #4
0
 public function init()
 {
     parent::init();
     $facebook = new Ishali_Facebook();
     $idpage = $facebook->getpageid();
     if (isset($idpage)) {
         $_SESSION['idpage'] = $idpage;
     }
 }
예제 #5
0
 public function init()
 {
     parent::init();
     $this->_SESSION = new Zend_Session_Namespace();
     $facebook = new Ishali_Facebook();
     $idpage = $facebook->getpageid();
     if (isset($idpage)) {
         $_SESSION['idpage'] = $idpage;
     }
 }
예제 #6
0
 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);
 }
예제 #7
0
 public function init()
 {
     $layoutPath = APPLICATION_PATH . '/templates/giaodien_admin';
     $option = array('layout' => 'index', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $facebook = new Ishali_Facebook();
     $facebook->getuserfbid();
     if ($facebook->getpageid() != "") {
         @($idpage = $facebook->getpageid());
         @($_SESSION['idpage'] = $idpage);
     } else {
         @($idpage = $_SESSION['idpage']);
     }
 }
예제 #8
0
 public function preDispatch()
 {
     $facebook = new Ishali_Facebook();
     //$facebook->begins_works(0);
     //$this->view->id_userr = $facebook->getuserfbid();
     //$this->view->id_fb_page = $facebook->getpageid();
     $facebook->getuserfbid();
     if ($facebook->getpageid() != "") {
         @($idpage = $facebook->getpageid());
         @($_SESSION['idpage'] = $idpage);
     } else {
         @($idpage = $_SESSION['idpage']);
     }
 }
 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;
         }
     }
 }
예제 #10
0
 public function preDispatch()
 {
     $this->_SESSION = new Zend_Session_Namespace();
     $facebook = new Ishali_Facebook();
     $config = Zend_Registry::get(APPLICATION_CONFIG);
     $pageLike = App_Models_PagelikeModel::getInstance();
     if ($facebook->getpageid() != "") {
         $idpage = $facebook->getpageid();
         $_SESSION['idpage'] = $idpage;
     } else {
         $idpage = $_SESSION['idpage'];
     }
     if (!isset($_SESSION['userLike'])) {
         $_SESSION['userLike'] = time();
         $userLike = $_SESSION['userLike'];
     } else {
         $userLike = $_SESSION['userLike'];
     }
     /*
     $infoPage = $pageLike->thongTinTrang($idpage);
     
     $linkPage = $infoPage[0]['link_page'];
     $appId = $config->facebook->appid;
     
     if($facebook->getParameterUrl() == "")
     {
     	$appData = "";
     	$linkPageApp = $linkPage . '/app_' . $appId;
     }
     else
     {
     	$appData = $facebook->getParameterUrl();
     	$linkPageApp = $linkPage . '/app_' . $appId . '?app_data=' . $appData;
     }
     */
     /* 		$idUserFB = $facebook->getuserfbid();
     		if($idUserFB == 0)
     		{
     			$facebook->userlogin($linkPageApp);
     		}
     		$_SESSION['idUserFB'] = $idUserFB; */
     //Cau hinh Layout
     $option = array('layout' => 'layout', 'layoutPath' => LAYOUT_PATH . '/tmplikepage');
     Zend_Layout::startMvc($option);
 }
예제 #11
0
 public function preDispatch()
 {
     $facebook = new Ishali_Facebook();
     $daugia = App_Models_DaugiaModel::getInstance();
     $config = Zend_Registry::get(APPLICATION_CONFIG);
     if ($facebook->getpageid() != "") {
         $idpage = $facebook->getpageid();
         $_SESSION['idpage'] = $idpage;
     }
     $userFB = $facebook->getuserfbid();
     if ($userFB == 0) {
         $infoPage = $daugia->thongTinTrang($idpage);
         $linkPage = $infoPage[0]['link_page'];
         $appId = $config->facebook->appid;
         $linkPageApp = $linkPage . '/app_' . $appId;
         $facebook->userlogin($linkPageApp);
     }
 }
예제 #12
0
 public function checkpermissions($perimssionkey)
 {
     $fb = Ishali_Facebook::getFB();
     $permissions = @$fb->api("/me/permissions");
     if (array_key_exists($perimssionkey, $permissions['data'][0])) {
         return 1;
     } else {
         return 0;
     }
 }
예제 #13
0
 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 = "";
     }
 }
예제 #14
0
 public function indexAction()
 {
     $store = $this->view->info = App_Models_StoreModel::getInstance();
     $flag = 0;
     if (isset($_GET['flag'])) {
         $flag = $_GET['flag'];
     }
     if (isset($_SESSION['idpage']) && $_SESSION['idpage'] != "") {
         $idpage = $_SESSION['idpage'];
         $this->view->idpage = $idpage;
     }
     $facebook = new Ishali_Facebook();
     if ($facebook->getuserfbid() == 0) {
         if ($flag == 1) {
             $this->view->isfbuser = 0;
         } else {
             $url = APP_DOMAIN . "/dathang?idpage=" . $idpage . "&flag=1";
             $facebook->userlogin($url);
         }
     } else {
         $facebook->getuserfbid();
         $user_profile = $facebook->getUserInfo();
         $this->view->isfbuser = 1;
         $this->view->linkfb = $user_profile['link'];
         $this->view->idfb = $user_profile['id'];
         $checkFbUserInDb = $store->checkFbUserInDb($idpage, $user_profile['id']);
         if (!empty($checkFbUserInDb)) {
             $this->view->name = $checkFbUserInDb[0]['name'];
             $this->view->phone = $checkFbUserInDb[0]['phone'];
             $this->view->email = $checkFbUserInDb[0]['email'];
             $this->view->district = $checkFbUserInDb[0]['district'];
             $this->view->address = $checkFbUserInDb[0]['address'];
         } else {
             $this->view->name = $user_profile['name'];
             $this->view->phone = "";
             $this->view->email = $user_profile['email'];
             $this->view->district = "";
             $this->view->address = "";
         }
     }
 }
예제 #15
0
 public function installpageAction()
 {
     //$store = $this->view->info = App_Models_StoreModel::getInstance();
     $bid = $this->view->info = App_Models_DaugiaModel::getInstance();
     $pageid = $_GET['pageid'];
     $pagename = $_GET['pagename'];
     $userid = $_GET['userid'];
     $appid = $_GET['appid'];
     $status = $_GET['status'];
     $facebook = new Ishali_Facebook();
     $linkpage = $facebook->getLinkPage($pageid);
     if ($status == 1) {
         $sql = "Select 1 from ishali_pages where id_fb_page = '" . $pageid . "' and id_fb = '" . $userid . "'";
         $data = $bid->SelectQuery($sql);
         if (count($data) > 0) {
             echo "<script>ThongBaoDongY('Fanpage <u>{$pagename}</u><br/>Đã được cài thành công vào ứng dụng.', '" . ROOT_DOMAIN . "/admin');</script>";
         } else {
             $link = "http://www.facebook.com/add.php?api_key={$appid}&pages=1&page={$pageid}";
             echo "<script>customerLoadWindow('{$link}', '', '540', '400');</script>";
             $sql = "Insert into ishali_pages(id_fb_page, page_name, id_fb, link_page, templates) value(";
             $sql .= "'" . $pageid . "', ";
             $sql .= "'" . $pagename . "', ";
             $sql .= "'" . $userid . "', ";
             $sql .= "'" . $linkpage . "', ";
             $sql .= "'tmpdaugia') ";
             $data = $bid->InsertDeleteUpdateQuery($sql);
             if ($data == 1) {
                 echo "<script>ThongBaoDongY('Sau khi cài ứng dụng lên FanPage thành công,<br/>Hãy nhấn nút Đóng', '" . ROOT_DOMAIN . "/admin');</script>";
             } else {
                 echo "<script>ThongBaoDongY('Cài ứng dụng không thành công<br/>Vui Lòng thực hiện lại thao tác.', '" . ROOT_DOMAIN . "/admin');</script>";
             }
         }
     } else {
         $link = "http://www.facebook.com/add.php?api_key={$appid}&pages=1&page={$pageid}";
         echo "<script>customerLoadWindow('{$link}', '', '540', '400');</script>";
         echo "<script>ThongBaoDongY('Sau khi cài ứng dụng lên FanPage thành công,<br/>Hãy nhấn nút Đóng', '" . ROOT_DOMAIN . "/admin');</script>";
     }
 }
예제 #16
0
 public function indexAction()
 {
     $facebook = new Ishali_Facebook();
     $this->view->fbuserid = $facebook->getuserfbid();
     if (isset($_GET['pageid']) && $_GET['pageid'] > 0) {
         $this->view->pageid = $_GET['pageid'];
         $this->view->page_name = $_GET['pagename'];
         $this->view->listArticle = App_Models_ArticleModel::getInstance()->getListByFbPage_admin($this->view->pageid);
         $this->view->list_pages = App_Models_ArticleModel::getInstance()->listArticlePages($this->view->fbuserid);
         $layoutPath = APPLICATION_PATH . '/templates/giaodien_admin';
         $option = array('layout' => 'article_ajax', 'layoutPath' => $layoutPath);
         Zend_Layout::startMvc($option);
     } else {
         $PagesList = App_Models_PagesModel::getInstance()->getList('', '', '', $this->view->fbuserid);
         $this->view->page_name = $PagesList[0]['page_name'];
         $this->view->pageid = $PagesList[0]['id_fb_page'];
         $this->view->listArticle = App_Models_ArticleModel::getInstance()->getListByFbPage_admin($this->view->pageid);
         $this->view->list_pages = App_Models_ArticleModel::getInstance()->listArticlePages($this->view->fbuserid);
         //		    $layoutPath = APPLICATION_PATH . '/templates/giaodien_admin';
         //	        $option = array('layout' => 'index', 'layoutPath' => $layoutPath);
         //	        Zend_Layout::startMvc($option);
     }
 }
예제 #17
0
 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;
 }
예제 #18
0
 public function binhchonAction()
 {
     $request = $this->getRequest();
     $this->view->curr_page = $request->getParam('search_page', 1);
     $this->view->count = 20;
     if (isset($_GET['thisinhid']) && $_GET['thisinhid'] > 0) {
         $facebook = new Ishali_Facebook();
         $this->view->fbuserid = $facebook->getuserfbid();
         $this->view->list_pages = App_Models_PagesModel::getInstance()->listSelectPages($this->view->fbuserid);
         $this->view->pagename = $request->getParam('pagename');
         $this->view->pageid = $request->getParam('pageid', 0);
         $this->view->id = $request->getParam('thisinhid', 0);
         //    		$this->view->page_name = $_GET['page_name'];
         $binhchondetail = App_Models_ImageInfoModel::getInstance()->getBinhchon($this->view->id, $this->view->curr_page, $this->view->count);
         $this->view->binhchondetail = $binhchondetail;
         $this->view->total = $binhchondetail['total'];
         $paging = array();
         $paging['totalRecord'] = $binhchondetail['total'];
         $paging['currentPage'] = $this->view->curr_page;
         $paging['numDisplay'] = 2;
         $paging['pageSize'] = $this->view->count;
         $paging['action'] = APP_DOMAIN . "/admin/thisinh/binhchon";
         $this->view->paging = json_encode($paging);
     }
     if ($request->getParam('isajax')) {
         $layoutPath = APPLICATION_PATH . '/templates/giaodien_admin';
         $option = array('layout' => 'install', 'layoutPath' => $layoutPath);
         Zend_Layout::startMvc($option);
     }
 }
예제 #19
0
 public function laydanhsachbanbe()
 {
     $fb = Ishali_Facebook::getFB();
     $userfriends = $fb->api('/me/friends');
     return $userfriends;
     //		echo "<pre>";
     //		print_r($userfriends);
     //		echo "</pre>";
     //		exit;
 }
예제 #20
0
 public function KiemTraSessionIdPage($sessionIdPage)
 {
     $facebook = new Ishali_Facebook();
     $idUserFB = $facebook->getuserfbid();
     $sql = "select 1 from ishali_pages where id_fb_page = '" . $sessionIdPage . "' and id_fb = '" . $idUserFB . "'";
     $data = $this->SelectQuery($sql);
     return count($data);
 }
예제 #21
0
 public function changepassAction()
 {
     $facebook = new Ishali_Facebook();
     $iduser_fb = $facebook->getuserfbid();
     $this->view->iduser_fb = $iduser_fb;
 }
예제 #22
0
 public static function getLinkPage($idpage)
 {
     $fb = Ishali_Facebook::getFB();
     $pages_fb = $fb->api('/' . $idpage);
     $linkpage = $pages_fb['link'];
     return $linkpage;
 }
예제 #23
0
 public function indexAction()
 {
     $fb = new Ishali_Facebook();
     $pageLike = App_Models_PagelikeModel::getInstance();
     $config = Zend_Registry::get(APPLICATION_CONFIG);
     $checkLike = $fb->kiemTraLike();
     //$checkLike = 1;
     if ($checkLike == "") {
         $link = APP_DOMAIN . '/index/yeucaulike';
         header("location: {$link}");
     } else {
         $idpage = @$_SESSION['idpage'];
         $this->view->linkAppPage = "";
         $this->view->linkNoiDung = "";
         $linkNoiDungPage = $pageLike->getLinkNoiDungCuaPage($idpage);
         $this->view->linknoidungpage = $linkNoiDungPage;
         /*
         	$userLike = $_SESSION['userLike'];
         			$pageLike->luuSessionUserLikePage($userLike, $idpage);//Sau khi like page, sẽ luu dia chi Mac va idPage
         		
         			$soLuotLikeTrongNgay = $pageLike->soLuotLikeTrongNgay($userLike);
         	$data = $pageLike->getConfig();//Lay Gia Tri Bang Config
         			$solanlike = $data['solanlike'];
         	if($soLuotLikeTrongNgay < $solanlike)
         			{
         				$appId = $config->facebook->appid;
         				$data = $pageLike->getPageLike();//List Page Like
         				if($data != "")
         				{
         					for($i=0; $i<count($data); $i++)
         					{
         						$idpage = $data[$i]['idpage'];
         						$checkLikePage = $pageLike->checkLikePage($userLike, $idpage);
         						if($checkLikePage == 1)//Page nay chua duoc like
         						{
         							if($fb->getParameterUrl() == "")
         							{
         								$linkAppPage = $data[$i]['linkpage'].'/app_'.$appId;
         							}
         							else
         							{
         								$idnoidung = $fb->getParameterUrl();
         								$linkAppPage = $data[$i]['linkpage'].'/app_'.$appId.'?app_data='.$idnoidung;
         							}
         							$this->view->linkAppPage = $linkAppPage;
         							return;
         						}
         					}//Truong hop Page nao cung da like
         					if($fb->getParameterUrl() == ""){
         						$this->view->linkAppPage = "";
         						$this->view->linkNoiDung = "";
         					}else{
         						$this->view->linkAppPage = "";
         						$idnoidung = $fb->getParameterUrl();
         						$linkNoiDung = $pageLike->getLinkNoiDung($idnoidung);
         						$this->view->linkNoiDung = $linkNoiDung;
         					}
         				}
         				else//Truong hop ko co page trong du lieu
         				{
         					if($fb->getParameterUrl() == ""){
         						$this->view->linkAppPage = "";
         						$this->view->linkNoiDung = "";
         					}else{
         						$this->view->linkAppPage = "";
         						$idnoidung = $fb->getParameterUrl();
         						$linkNoiDung = $pageLike->getLinkNoiDung($idnoidung);
         						$this->view->linkNoiDung = $linkNoiDung;
         					}
         				}
         					
         			}
         			else//Truong hop user da like du so luong
         			{
         				if($fb->getParameterUrl() == ""){
         						$this->view->linkAppPage = "";
         						$this->view->linkNoiDung = "";
         				}else{
         					$this->view->linkAppPage = "";
         					$idnoidung = $fb->getParameterUrl();
         					$linkNoiDung = $pageLike->getLinkNoiDung($idnoidung);
         					$this->view->linkNoiDung = $linkNoiDung;
         				}
         			}
         */
     }
 }
예제 #24
0
 public function chuyenLinkThanhHttps($idpage)
 {
     if ($_SERVER["HTTPS"] != "on") {
         $facebook = new Ishali_Facebook();
         $fb = $facebook->getFB();
         $id_fb_page = '/' . $idpage;
         $pages_fb = $fb->api($id_fb_page);
         $linkPage = $pages_fb['link'];
         //http://www.facebook.com/Phtpht
         $lPage = substr($linkPage, 4);
         $linkHttps = 'https' . $lPage . '/app_' . APP_ID;
         return $linkHttps;
     } else {
         return true;
     }
 }
예제 #25
0
 public function preDispatch()
 {
     $request = $this->getRequest();
     $facebook = new Ishali_Facebook();
     /*
     http://www.facebook.com/pages/HCM/448507661830693?sk=app_121397851394173&app_data=index/detail?id=109
     
     		$pagedata  = $facebook->getpagearr();
     		echo "<pre>";
     		print_r($pagedata['app_data']);
     		echo "</pre>";
     //exit;
     */
     if (isset($_GET['request_ids'])) {
         $ts = $_GET['request_ids'];
     } else {
         $ts = 0;
     }
     $facebook->begins_works($ts);
     $this->view->id_fb_page = $facebook->getpageid();
     $this->view->id_user = $facebook->getuserfbid();
     // TODO:
     //        $this->view->id_fb_page = 123453;
     //        $this->view->id_fb_page ='388347091211147';
     //        $this->view->id_user = 9999;
     /*
      * get page info
      */
     // exit;
     if ($this->view->id_fb_page <= 0) {
         $this->view->id_fb_page = $_SESSION['idpage'];
     } else {
         $_SESSION['idpage'] = $this->view->id_fb_page;
     }
     //         echo $_SESSION['idpage'];
     $page = new App_Entities_Pages();
     $page = App_Models_PagesModel::getInstance()->getDetail($this->view->id_fb_page);
     //        echo $page->an_hien;
     //        exit;
     //$this->_redirect('/home/index');
     if ($page->an_hien == 0) {
         //   $this->_redirect('/thongbao');
     }
     //         echo $page->templates;
     /*
      * init layout
      */
     /*End thiet lap nhan tin*/
     $fb = $facebook->getFB();
     if (isset($_GET['request_ids'])) {
         $reqId = $_GET['request_ids'];
         $requests = $fb->api('/me/apprequests/?request_ids=' . $reqId);
         $itemData = $requests['data'][0]['data'];
         //		 echo "<pre>";
         //		 print_r($requests);
         //		 echo "</pre>";
         //		 exit;
         if (isset($itemData) && $itemData != "") {
             echo "<script language='javascript'>top.location.href='" . $itemData . "'</script>";
             exit(0);
         } else {
             if (isset($requests['data'][1]['data']) && $requests['data'][1]['data'] != "") {
                 echo "<script language='javascript'>top.location.href='" . $requests['data'][1]['data'] . "'</script>";
                 exit(0);
             } else {
                 if (isset($requests['data'][2]['data']) && $requests['data'][2]['data'] != "") {
                     echo "<script language='javascript'>top.location.href='" . $requests['data'][2]['data'] . "'</script>";
                     exit(0);
                 }
             }
         }
     }
     /*End thiet lap nhan tin*/
     $option = array('layout' => 'layout', 'layoutPath' => LAYOUT_PATH . '/' . $page->templates);
     Zend_Layout::startMvc($option);
     /*
      * get menu
      */
     $listMenu = App_Models_ArticleModel::getInstance()->getListByFbPage($this->view->id_fb_page);
     /*
      * assign param
      */
     $this->view->page = $page;
     $this->view->appTitle = $page->page_name;
     $this->view->appFooter = $page->footer;
     $this->view->bodystyle = "font-size:{$page->font_size};";
     $this->view->bodystyle .= 'color:' . $page->color . ';';
     if ($page->background_images != null && $page->background_images != '') {
         $page_background = APP_DOMAIN . '/public/images/background_images/' . $page->background_images;
         $this->view->bodystyle .= 'background-image: url(' . $page_background . ');';
     } else {
         if ($page->background_color != null && $page->background_color != '') {
             $this->view->bodystyle .= 'background-color:' . $page->background_color . ';';
         }
     }
     $this->view->listMenu = $listMenu;
 }
예제 #26
0
 public function testAction()
 {
     //$this->_helper->viewRenderer->setNoRender(true);
     //$this->_helper->layout->disableLayout();
     $store = App_Models_StoreModel::getInstance();
     $facebook = new Ishali_Facebook();
     //$albums = $facebook->getAlbums();
     $albumsPage = $facebook->getAlbumsPage('356730004423499');
     print_r($albumsPage);
     //$this->view->albums = $albums;
     //$accessToken = $facebook->getAccessToken();exit;
     //$this->view->accessToken = $accessToken;
     //$photo = $facebook->getPhotoInAlbums('568424473254050');
     //print_r($photo);exit;
 }
예제 #27
0
 public function updatepage()
 {
     $id_fb_page = $_POST['id_fb_page'];
     $banner_link = $_POST['banner_link'];
     $templates = $_POST['templates'];
     $show_gioi_tinh = $_POST['show_gioi_tinh'];
     $show_ma = $_POST['show_ma'];
     $show_ten = $_POST['show_ten'];
     $show_luot_xem = $_POST['show_luot_xem'];
     $show_so_binh_chon = $_POST['show_so_binh_chon'];
     $show_gioi_thieu = $_POST['show_gioi_thieu'];
     $so_lan_binh_chon = $_POST['so_lan_binh_chon'];
     $like_binh_chon = $_POST['like_binh_chon'];
     $like_tham_gia = $_POST['like_tham_gia'];
     $like_comment = $_POST['like_comment'];
     $cam_on_binh_chon = $_POST['cam_on_binh_chon'];
     $cam_on_tham_gia = $_POST['cam_on_tham_gia'];
     $footer = $_POST['footer'];
     $font_size = $_POST['font_size'];
     $background_color = $_POST['background_color'];
     $background_images = $_POST['background_images'];
     $color = $_POST['color'];
     if ($_FILES['banner']['name'] != "") {
         $urlhinh = time() . '_' . $_FILES["banner"]['name'];
         move_uploaded_file($_FILES["banner"]['tmp_name'], "public/images/banner/" . $urlhinh);
         $banner = "`banner` = '{$urlhinh}' , ";
     } else {
         $banner = ' ';
     }
     if ($_FILES['background_images']['name'] != "") {
         $urlhinh = time() . '_' . $_FILES["background_images"]['name'];
         move_uploaded_file($_FILES["background_images"]['tmp_name'], "public/images/background_images/" . $urlhinh);
         $background_images = "`background_images` = '{$urlhinh}' , ";
     } else {
         $background_images = ' ';
     }
     $str_update = "UPDATE `ishali_pages` \r\n\t\t\t\t\t\tSET\t\t\t\r\n\t\t\t\t\t\t{$banner}\r\n\t\t\t\t\t\t`banner_link` = '{$banner_link}' , \r\n\t\t\t\t\t\t`templates` = '{$templates}' , \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t`show_gioi_tinh` = '{$show_gioi_tinh}' , \r\n\t\t\t\t\t\t`show_ma` = '{$show_ma}' , \r\n\t\t\t\t\t\t`show_ten` = '{$show_ten}' , \r\n\t\t\t\t\t\t`show_luot_xem` = '{$show_luot_xem}' , \r\n\t\t\t\t\t\t`show_so_binh_chon` = '{$show_so_binh_chon}' , \r\n\t\t\t\t\t\t`show_gioi_thieu` = '{$show_gioi_thieu}' , \r\n\t\t\t\t\t\t`so_lan_binh_chon` = '{$so_lan_binh_chon}' , \r\n\t\t\t\t\t\t`like_binh_chon` = '{$like_binh_chon}' , \r\n\t\t\t\t\t\t`like_tham_gia` = '{$like_tham_gia}' , \r\n\t\t\t\t\t\t`like_comment` = '{$like_comment}' , \r\n\t\t\t\t\t\r\n\t\t\t\t\t\t`cam_on_binh_chon` = '{$cam_on_binh_chon}' , \r\n\t\t\t\t\t\t`cam_on_tham_gia` = '{$cam_on_tham_gia}' , \r\n\t\t\t\t\t\t`footer` = '{$footer}' , \r\n\t\t\t\t\t\t`font_size` = '{$font_size}' , \r\n\t\t\t\t\t\t`background_color` = '{$background_color}' , \r\n\t\t\t\t\t\t{$background_images} \r\n\t\t\t\t\t\t`color` = '{$color}'\t\t\t\t\t\t\r\n\t\t\t\t\t\tWHERE\t`id_fb_page` = '{$id_fb_page}' ;\r\n\t\t\t\t\t";
     $this->_db->executeReader($str_update);
     //			$config = Zend_Registry::get(APPLICATION_CONFIG);
     $url = Ishali_Facebook::directadminlink();
     //		$url = 'http://apps.facebook.com/tochuccuocthihinh/admin';
     echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">";
     exit("Nội dung đang được luu.....<script>window.top.location.replace('{$url}');</script>");
 }
예제 #28
0
 public static function getUserInfo()
 {
     $fb = Ishali_Facebook::getFB();
     $albums = $fb->api('/me');
     return $albums;
 }