switch ($login) { case 0: $fcn = "rg_twa_cb({e:4,n:'',sn:'',i:''})"; break; case 1: $fcn = "lg_twa_cb(4)"; break; case 2: $fcn = "ap_twa_cb({e:4,n:'',sn:'',i:''})"; break; } error_log("Log is {$login}"); try { if ($htw = new Handler_Twitter()) { if ($callback = $htw->generateOAuth('http://apreciodepana.com/fcn/f_manager/c_add_tw_alt.php?state=' . $login)) { $hsc = new Handler_NewSocialConnection(); $hsc->startTwitterFlow(true, $callback['oauth_token'], $callback['oauth_token_secret']); header('location:' . $callback['url']); exit; } else { header("location:http://apreciodepana.com/redes.php?tipo=1&add_tw=4"); exit; } } else { header("location:http://apreciodepana.com/redes.php?tipo=1&add_tw=4"); exit; } } catch (Exception $e) { header("location:http://apreciodepana.com/redes.php?tipo=1&add_tw=4"); exit; }
<?php require_once "../../clases/manager/autoload.php"; require_once "../../clases/bd.php"; use OneAManager\Handler_Facebook; use OneAManager\Handler_NewSocialConnection; $login = $_GET['state'] ? $_GET['state'] : 0; try { $fbh = new Handler_Facebook(); $hsc = new Handler_NewSocialConnection(); $db = new bd(); $permissions = ['user_posts', 'publish_actions', 'user_photos', 'manage_pages', 'publish_pages']; if ($info = $fbh->javascriptCallbackManager($permissions)) { $uid = $info['user_id']; $at = $info['access_token']; $table = "manager_fb_acc"; $condition = " user_id=" . $uid; if ($result = $db->doSingleSelect($table, $condition)) { //account already belongs to a user if ($info["e"]) { //some error, could mean a lot of things, but whichever the case we need to expire all the accounts. $fbh->revokePermissions($at, array()); $fields = array('expires_at' => 1, 'expired' => 1); $db->doUpdate($table, $fields, $condition); $return = array("e" => 2); } else { $ea = $info['expires_at']; $fields = array('access_token' => $at, 'expires_at' => $ea, 'expired' => 0); $db->doUpdate($table, $fields, $condition); switch ($login) { case 0:
$fun = "rg_twa_cb({e:{$e},n:{$c},sn:{$d},i:{$i},d:{$b},l:{$l}})"; break; case 1: $fun = "lg_twa_cb({$e})"; break; case 2: $fun = "ap_twa_cb({e:{$e},n:{$c},sn:{$d},i:{$i},d:{$b},l:{$l}})"; break; } echo "I be here"; $body = "<script type='text/javascript'>if(window.opener){window.opener.{$fun};}window.close();</script>"; return $body; } $login = $_GET['state'] ? $_GET['state'] : 0; error_log($login); $hsc = new Handler_NewSocialConnection(); $request_token = $hsc->getTwitterFlowRequestToken(); $e = 0; $d = false; $c = false; $i = false; if (isset($_REQUEST['oauth_token']) && $request_token['oauth_token'] !== $_REQUEST['oauth_token']) { $hsc->clearFlow(); exit(makeBody(4)); } else { if ($_REQUEST['denied']) { exit(makeBody(2)); } try { if ($htw = new Handler_Twitter($request_token['oauth_token'], $request_token['oauth_token_secret'])) { if ($access_token = $htw->generateAccessToken($_REQUEST['oauth_verifier'])) {
<?php require_once "../../clases/manager/autoload.php"; require_once "../../clases/bd.php"; use OneAManager\Handler_Twitter; use OneAManager\Handler_NewSocialConnection; $login = $_GET['state'] ? $_GET['state'] : 0; $hsc = new Handler_NewSocialConnection(); $request_token = $hsc->getTwitterFlowRequestToken(); $e = 0; $d = false; $c = false; $i = false; if (isset($_REQUEST['oauth_token']) && $request_token['oauth_token'] !== $_REQUEST['oauth_token']) { $hsc->clearFlow(); header("location:http://apreciodepana.com/redes.php?tipo=1&add_tw=4"); } else { if ($_REQUEST['denied']) { header("location:http://apreciodepana.com/redes.php?tipo=1&add_tw=2"); } try { if ($htw = new Handler_Twitter($request_token['oauth_token'], $request_token['oauth_token_secret'])) { if ($access_token = $htw->generateAccessToken($_REQUEST['oauth_verifier'])) { $fields = array("type" => "tw_acc", "token" => $access_token["oauth_token"], "token_secret" => $access_token["oauth_token_secret"], "screen_name" => $access_token["screen_name"], "user_id" => $access_token["user_id"]); $db = new bd(); $table = "manager_tw_acc"; $condition = " user_id=" . $access_token["user_id"]; if ($result = $db->doSingleSelect($table, $condition)) { error_log($result); //cuenta pertenece a otro usuario header("location:http://apreciodepana.com/redes.php?tipo=1&add_tw=1");
public function crearUsuario() { if (isset($this->n_identificacion) xor isset($this->j_rif)) { if (isset($this->a_seudonimo)) { $bd = new bd(); $result = $bd->doInsert($this->u_table, $this->serializarDatos("u_")); if ($result == true) { $result = 0; $this->id = $bd->lastInsertId(); $hnsc = new Handler_NewSocialConnection(); if ($red_social = $hnsc->returnTableAndBody($this->id)) { if (!$bd->doInsert($red_social['table'], $red_social['fields'])) { error_log('Error occurred:' . implode(":", $bd->errorInfo())); } } if (isset($this->n_identificacion)) { $result += $bd->doInsert($this->n_table, $this->serializarDatos("n_", $this->u_table)); } else { $result += $bd->doInsert($this->j_table, $this->serializarDatos("j_", $this->u_table)); } $result += $bd->doInsert($this->a_table, $this->serializarDatos("a_", $this->u_table)); $result += $bd->doInsert($this->s_table, $this->serializarDatos("s_", array($this->s_f_table, $this->u_table))); if ($result >= 3) { return true; } else { return false; } } else { return false; } } else { throw new Exception("Error Usuario 004: No se han definido datos de acceso"); } } else { throw new Exception("Error Usuario 003: No se han definido datos Juridicos o Naturales"); } }