Пример #1
0
        $message_type = failure;
    }
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote(_REQUIREDNOTE);
$form->accept($renderer);
$smarty->assign('T_LOGIN_FORM', $renderer->toArray());
if (G_VERSIONTYPE != 'community') {
    #cpp#ifndef COMMUNITY
    /** Facebook connect ***/
    if ($GLOBALS['configuration']['social_modules_activated'] & FB_FUNC_LOGGING) {
        try {
            if ($GLOBALS['configuration']['facebook_api_key'] && $GLOBALS['configuration']['facebook_secret']) {
                $facebook_inteface = 1;
                $cookie = get_new_facebook_cookie($GLOBALS['configuration']['facebook_api_key'], $GLOBALS['configuration']['facebook_secret']);
                //$facebook_user = json_decode(file_get_contents('https://graph.facebook.com/me?access_token='.$cookie['access_token']));
                if (!isset($_GET['logout']) && !empty($cookie['user_id'])) {
                    $smarty->assign("T_NO_FACEBOOK_LOGIN", 1);
                    $facebook_inteface = 0;
                    try {
                        new EfrontFacebook($cookie['user_id']);
                        $eF_user = eF_getTableData("facebook_connect JOIN users ON users.login = facebook_connect.users_LOGIN", "users_LOGIN, password", "fb_uid='" . $cookie['user_id'] . "'");
                        $user = EfrontUserFactory::factory($eF_user[0]['users_LOGIN']);
                        $user->login($eF_user[0]['password'], true);
                        if ($GLOBALS['configuration']['show_license_note'] && $user->user['viewed_license'] == 0) {
                            eF_redirect("index.php?ctg=agreement");
                        } else {
                            EfrontEvent::triggerEvent(array("type" => EfrontEvent::SYSTEM_VISITED, "users_LOGIN" => $user->user['login'], "users_name" => $user->user['name'], "users_surname" => $user->user['surname']));
                            loginRedirect($user->user['user_type']);
                        }
Пример #2
0
 /**
  * Set user status
  *
  * This function is used to set the user's status.
  * <br/>Example:
  * <code>
  * $user -> setStatus("Carpe Diem!");
  * </code>
  *
  * @param string to be set as the new status - could be ""
  * @return boolean True if everything is ok
  * @since 3.6.0
  * @access public
  */
 public function setStatus($status)
 {
     if ($_SESSION['facebook_user'] && $_SESSION['facebook_details']['status']['message'] != $status) {
         $path = "../libraries/";
         require_once $path . "external/facebook/facebook.php";
         $facebook = new Facebook(array('appId' => $GLOBALS['configuration']['facebook_api_key'], 'secret' => $GLOBALS['configuration']['facebook_secret'], 'cookie' => true));
         //$access_token = $facebook -> getAccessToken();
         $cookie = get_new_facebook_cookie($GLOBALS['configuration']['facebook_api_key'], $GLOBALS['configuration']['facebook_secret']);
         /*
         try {
         	$status_ret = file_get_contents('http://graph.facebook.com/v2.2/'.$_SESSION['facebook_user'].'/feed?access_token='.$cookie['access_token'].'&message='.$status);
         	$status_ret_object = json_decode($status_ret, true);
         } catch (Exception $e) {
         	//pr($e);
         }
         
         
         try	{
         	$permissions = $facebook -> api('/'.$_SESSION['facebook_user'].'/permissions');
         	$postResult = $facebook -> api('/'.$_SESSION['facebook_user'].'/feed', 'post', array('message' => $status));
         
         } catch (Exception $e) {
         	//pr($e);
         }
         
         
         //old way
         $fql = "SELECT publish_stream FROM permissions WHERE uid =".$_SESSION['facebook_user'];
         $publish_info = $facebook->api(array(
         		'method' => 'fql.query',
         		'query' => $fql,
         ));
         		
         
         $canPublish = 0;
         if (!empty($publish_info)) {
         	$canPublish = $publish_info[0]['publish_stream'];
         }
         
         if (!$canPublish) {			
         	$dialog_url = "https://www.facebook.com/dialog/oauth?client_id=". $GLOBALS['configuration']['facebook_api_key']."&redirect_uri=".G_SERVERNAME.$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."&scope=read_stream,status_update";
         	echo json_encode(array('redirect' => $dialog_url)); 
         	exit;
         }		
         
         //$perms = json_decode(file_get_contents('https://graph.facebook.com/me/permissions?access_token=' . $access_token));
         //$_SESSION['facebook_can_update'] = $perms->data[0]->status_update;		
         
         $facebook->api ( array(
         		'method' => 'users.setStatus',
         		 'status' => $status,
         		 'uid'    => $_SESSION['facebook_user'],
         		 'status_includes_verb' => true
         ) );
         
         
         //	$facebook->api_client->call_method("facebook.users.setStatus", array("status" => $status, "status_includes_verb" => true));
         //	$temp = $facebook->api_client->fql_query("SELECT status FROM user WHERE uid = " . $_SESSION['facebook_user']);
         $_SESSION['facebook_details']['status'] = $status;
         */
     }
     eF_updateTableData("users", array("status" => $status), "login = '******'login'] . "'");
     $this->user['status'] = $status;
     EfrontEvent::triggerEvent(array("type" => EfrontEvent::STATUS_CHANGE, "users_LOGIN" => $this->user['login'], "users_name" => $this->user['name'], "users_surname" => $this->user['surname'], "entity_name" => $status));
     return true;
 }