Example #1
0
 /**
  * Metodo encargado de procesar los errores y enviarlos a la pagina principal
  * @param type $msg,  Mensaje personalizado
  * @param type $tituloPagina, String con el titulo de la pagina
  * @param type $codError, Int codigo del error generado y a ser mostrado.
  */
 public function procesarError($msg, $tituloPagina, $codError = 0)
 {
     $pathtoVista = "./modulos/{$this->nombre}/views/index.php";
     $parametros = array('error' => $codError, 'titulo' => $tituloPagina, 'mensaje' => $msg);
     $view = parent::cargarVista($pathtoVista, 'index', $parametros);
     parent::renderizarPagina($view->getHTML(), $view->getParametros());
 }
Example #2
0
 /**
  * Metodo inicial del Modulo de facebook, donde se obtiene el codigo generado por facebook. Luego de que el cliente acepte 
  * luego envia una peticion para obtener un accessToken 
  */
 function confirmarIdentidad()
 {
     if (!empty($_GET['code'])) {
         $redirectURL = "http://anfho93.sytes.net/facebook/home/confirmarIdentidad";
         //$url = "Location: https://graph.facebook.com/oauth/access_token?client_id=" . APPID . "&redirect_uri=" . $redirectURL . "&client_secret=" . APPSECRET . "&code=" . $_GET['code'];
         $url = "https://graph.facebook.com/oauth/access_token?client_id=" . APPID . "&redirect_uri=" . $redirectURL . "&client_secret=" . APPSECRET . "&code=" . $_GET['code'];
         $accessToken = file_get_contents($url);
         @(list($aT, $expiracion) = explode("&", $accessToken, 2));
         list($i, $valorToken) = explode("=", $aT);
         list($j, $expiracion) = explode("=", $expiracion);
         //Luego de tener el token y su tiempo de expiracion es necesario inspeccionarlos
         //para ello es necesario obtener un APP token de la aplicacion
         $url = "https://graph.facebook.com/oauth/access_token?client_id=" . APPID . "&client_secret=" . APPSECRET . "&grant_type=client_credentials";
         $appToken = file_get_contents($url);
         list($k, $appToken) = explode("=", $appToken);
         $arrayInspeccion = $this->inspeccionarToken(trim($valorToken, '"'), trim($expiracion, '"'), trim($appToken, '"'));
         $validez = $arrayInspeccion["data"]["is_valid"];
         if ($validez) {
             //el token es valido.
             $this->login(trim($appToken, '"'), trim($valorToken, '"'), $expiracion);
         } else {
             $pathtoVista = "./modulos/{$this->nombre}/views/Facebook.php";
             $view = parent::cargarVista($pathtoVista, 'Facebook', array("json" => $arrayInspeccion));
             parent::renderizarPagina($view->getHTML('error'), $view->getParametros());
         }
     } else {
         //nego la peticion
         if ($_GET['error_reason'] != null) {
             //se muestra el error enviado por facebook.
             $app = Aplication::getInstance();
             $msg = $_GET["error_reason"] . " " . $_GET["error"] . " " . $_GET['error_description'];
             $app->error('000', $msg, "Cancelaste el facebook Login");
         }
     }
 }
 public function index()
 {
     if (empty($_COOKIE['programate']) && isset($_SESSION['autenticado']) && $_SESSION['autenticado']) {
         $pathtoVista = "./modulos/rovi/views/login.php";
         $view = parent::cargarVista($pathtoVista, 'login', null);
         parent::renderizarPagina($view->getHTML(), $view->getParametros());
     } else {
         $pathtoVista = "./modulos/rovi/views/Favoritos.php";
         $view = parent::cargarVista($pathtoVista, 'Favoritos', array("canales" => $this->getCanalesFavoritos()));
         parent::renderizarPagina($view->getHTML(), $view->getParametros());
     }
 }
 /**
  * Retorna las peliculas preferidas del usuario.
  */
 public function mispreferencias()
 {
     //verifica si inicio sesion
     if ($this->isLoggedIn()) {
         $peliculas = $this->getPeliculas();
         $programas = $this->getProgramasTelevision();
         $infoSparql = $this->getInfoPeliculasRelacionadas($this->nombrePeliculasFacebook);
         $infoSparql = $this->getInfoPeliculaRovi($infoSparql);
         $pathtoVista = "./modulos/{$this->nombre}/views/index.php";
         $view = parent::cargarVista($pathtoVista, 'index', array("peliculas" => $peliculas, 'programas' => $programas, 'sugerencias' => $infoSparql));
         parent::renderizarPagina($view->getHTML('sugerir'), $view->getParametros());
     } else {
         header("Location: /index/home/index");
     }
 }
Example #5
0
 /**
  * 
  * @param type $horario
  * @return type
  */
 private function darGRID($horario, $horaInicial)
 {
     $pathtoVista = "./modulos/rovi/views/Grid.php";
     $dayPickerView = parent::cargarVista($pathtoVista, 'Grid', null);
     return $dayPickerView->getHTML($horaInicial, $horario);
 }
Example #6
0
 public function donacion()
 {
     $pathtoVista = "./modulos/{$this->nombre}/views/index.php";
     $view = parent::cargarVista($pathtoVista, 'index', null);
     parent::renderizarPagina($view->getHTML('donacion'), $view->getParametros());
 }
Example #7
-2
 public function recibirInformacion()
 {
     session_start();
     if (isset($_GET['code'])) {
         $tokenDetails = $this->getAccessTokenDetails(APPID, APPSECRET, URL_REDIRECT, $_GET['code']);
         $token = $tokenDetails['access_token'];
         $_SESSION['access_token'] = $token;
         $config = array();
         $config['appId'] = APPID;
         $config['secret'] = APPSECRET;
         $facebook = new Facebook($config);
         if (isset($_SESSION['access_token'])) {
             // echo "entre";
             $facebook->setAccessToken($_SESSION['access_token']);
         }
         //  $user_id = $facebook->getUser();
         $opcion = "";
         $query = "";
         $jsonDecodificado = "";
         if (isset($_REQUEST['opcion'])) {
             $opcion = $_REQUEST['opcion'];
         }
         if (isset($_REQUEST['query'])) {
             $query = $_REQUEST['query'];
         }
         if ($opcion != "") {
             $jsonDecodificado = json_encode($facebook->api('/me/' . $opcion));
         } else {
             if ($query != "") {
                 $jsonDecodificado = json_encode($facebook->api(array('method' => 'fql.query', 'query' => $query)));
             } else {
                 $jsonDecodificado = json_encode($facebook->api('/me'));
             }
         }
         $pathtoVista = "./modulos/{$this->nombre}/views/index.php";
         parent::asignar(array('contenido' => $pathtoVista, 'json' => $jsonDecodificado));
         parent::cargarVista('index', $parametros);
         // header('Location: ' . URL_PAGE);
     }
 }