当前位置: 首页>>代码示例>>PHP>>正文


PHP Hybrid_Error::setError方法代码示例

本文整理汇总了PHP中Hybrid_Error::setError方法的典型用法代码示例。如果您正苦于以下问题:PHP Hybrid_Error::setError方法的具体用法?PHP Hybrid_Error::setError怎么用?PHP Hybrid_Error::setError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hybrid_Error的用法示例。


在下文中一共展示了Hybrid_Error::setError方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processAuthDone

 /**
  * define:endpoint step 3.1 and 3.2
  */
 public static function processAuthDone()
 {
     Hybrid_Endpoint::authInit();
     $provider_id = trim(strip_tags(Hybrid_Endpoint::$request["hauth_done"]));
     $hauth = Hybrid_Auth::setup($provider_id);
     if (!$hauth) {
         Hybrid_Logger::error("Endpoint: Invalide parameter on hauth_done!");
         $hauth->adapter->setUserUnconnected();
         header("HTTP/1.0 404 Not Found");
         die("Invalide parameter! Please return to the login page and try again.");
     }
     try {
         Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
         $hauth->adapter->loginFinish();
     } catch (Exception $e) {
         Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
         Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
         $hauth->adapter->setUserUnconnected();
     }
     Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
     $hauth->returnToCallbackUrl();
     die;
 }
开发者ID:a303,项目名称:smart_lp2,代码行数:26,代码来源:Endpoint.php

示例2: processAuthDone

 /**
  * define:endpoint step 3.1 and 3.2
  */
 public static function processAuthDone()
 {
     Hybrid_Endpoint::authInit();
     // Fix a strange behavior when some provider call back ha endpoint
     // with /index.php?hauth.done={provider}?{args}...
     if (strrpos($_SERVER["QUERY_STRING"], '?')) {
         $_SERVER["QUERY_STRING"] = str_replace("?", "&", $_SERVER["QUERY_STRING"]);
         parse_str($_SERVER["QUERY_STRING"], Hybrid_Endpoint::$request);
     }
     $provider_id = trim(strip_tags(Hybrid_Endpoint::$request["hauth_done"]));
     $hauth = Hybrid_Auth::setup($provider_id);
     if (!$hauth) {
         Hybrid_Logger::error("Endpoint: Invalide parameter on hauth_done!");
         $hauth->adapter->setUserUnconnected();
         header("HTTP/1.0 404 Not Found");
         die("Invalide parameter! Please return to the login page and try again.");
     }
     try {
         Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
         $hauth->adapter->loginFinish();
     } catch (Exception $e) {
         Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
         Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
         $hauth->adapter->setUserUnconnected();
     }
     Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
     $hauth->returnToCallbackUrl();
     die;
 }
开发者ID:rwohleb,项目名称:hybridauth,代码行数:32,代码来源:Endpoint.php

示例3: str_replace

        // with /index.php?hauth.done={provider}?{args}...
        if (strrpos($_SERVER["QUERY_STRING"], '?')) {
            $_SERVER["QUERY_STRING"] = str_replace("?", "&", $_SERVER["QUERY_STRING"]);
            parse_str($_SERVER["QUERY_STRING"], $_REQUEST);
        }
        $provider_id = trim(strip_tags($_REQUEST["hauth_done"]));
        $hauth = Hybrid_Auth::setup($provider_id);
        if (!$hauth) {
            Hybrid_Logger::error("Endpoint: Invalide parameter on hauth_done!");
            $hauth->adapter->setUserUnconnected();
            header("HTTP/1.0 404 Not Found");
            die("Invalide parameter! Please return to the login page and try again.");
        }
        try {
            Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
            $hauth->adapter->loginFinish();
        } catch (Exception $e) {
            Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
            Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
            $hauth->adapter->setUserUnconnected();
        }
        Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
        $hauth->returnToCallbackUrl();
        die;
    }
} else {
    # Else,
    # We advertise our XRDS document, something supposed to be done from the Realm URL page
    echo str_replace("{X_XRDS_LOCATION}", Hybrid_Auth::getCurrentUrl(false) . "?get=openid_xrds&v=" . Hybrid_Auth::$version, file_get_contents(dirname(__FILE__) . "/Hybrid/resources/openid_realm.html"));
    die;
}
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:31,代码来源:index.php

示例4: processAuthDone

 /**
  * Define: endpoint step 3.1 and 3.2
  * @return void
  * @throws Hybrid_Exception
  */
 protected function processAuthDone()
 {
     $this->authInit();
     $provider_id = trim(strip_tags($this->request["hauth_done"]));
     $hauth = Hybrid_Auth::setup($provider_id);
     if (!$hauth) {
         Hybrid_Logger::error("Endpoint: Invalid parameter on hauth_done!");
         $hauth->adapter->setUserUnconnected();
         throw new Hybrid_Exception("Invalid parameter! Please return to the login page and try again.");
     }
     try {
         Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
         $hauth->adapter->loginFinish();
     } catch (Exception $e) {
         Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
         Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e->getPrevious());
         $hauth->adapter->setUserUnconnected();
     }
     Hybrid_Logger::info("Endpoint: job done. return to callback url.");
     $hauth->returnToCallbackUrl();
     die;
 }
开发者ID:kalypso63,项目名称:social_auth,代码行数:27,代码来源:Endpoint.php

示例5: processAuthDone

 /**
  * define:endpoint step 3.1 and 3.2
  */
 protected function processAuthDone()
 {
     $provider_id = trim($this->getProperty('hauth_done'));
     $hauth = Hybrid_Auth::setup($provider_id);
     if (!$hauth) {
         Hybrid_Logger::error("Endpoint: Invalid parameter on hauth_done!");
         $hauth->adapter->setUserUnconnected();
         header("HTTP/1.0 404 Not Found");
         return "Invalid parameter! Please return to the login page and try again.";
     }
     try {
         Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
         $hauth->adapter->loginFinish();
     } catch (Exception $e) {
         Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
         Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
         $hauth->adapter->setUserUnconnected();
     }
     Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
     // Save profile data in session
     $profile = $hauth->adapter->getUserProfile();
     // Try to get user by social profile
     /*$q = $this->modx->newQuery('modUser');
       $q->innerJoin('modUserProfile', 'Profile');
       $q->innerJoin('modHybridAuthUserProfile', 'SocialProfile');
       $q->innerJoin('modHybridAuthProvider', 'Provider', "Provider.id=SocialProfile.provider");
       $q->where(array(
           "SocialProfile.identifier"  => $profile->identifier,
           "Provider.name"     => $provider,
           "modUser.active"    => 1,
           "Profile.blocked"   => 0,
       ));
       $q->limit(1);
       
       if($user = $this->modx->getObject('modUser', $q)){
           $user->addSessionContext($this->modx->context->key);
           $redirectTo = $this->modx->getOption('site_url');
           $this->modx->sendRedirect($redirectTo);
           return;
       }*/
     // else
     $_SESSION['social_profile'] = array('provider' => $provider_id, 'profile' => $this->modx->error->toArray($profile));
     //$q->prepare();
     //$this->modx->log(1, $q->toSQL());
     // else
     $hauth->returnToCallbackUrl();
     return '';
 }
开发者ID:Tramp1357,项目名称:atlasorg,代码行数:51,代码来源:endpoint.class.php

示例6: processAuthDone

 /**
  * define:endpoint step 3.1 and 3.2
  */
 public static function processAuthDone()
 {
     Hybrid_Endpoint::authInit();
     $provider_id = trim(strip_tags(Hybrid_Endpoint::$request["hauth_done"]));
     # check if page accessed directly
     if (!Hybrid_Auth::storage()->get("hauth_session.{$provider_id}.hauth_endpoint")) {
         throw new Hybrid_Exception("You cannot access this page directly.");
     }
     $hauth = Hybrid_Auth::setup($provider_id);
     if (!$hauth) {
         $hauth->adapter->setUserUnconnected();
         throw new Hybrid_Exception("Invalid parameter! Please return to the login page and try again.");
     }
     try {
         $hauth->adapter->loginFinish();
     } catch (Exception $e) {
         Hybrid_Error::setError($e->getMessage(), $e->getCode());
         $hauth->adapter->setUserUnconnected();
     }
     $hauth->returnToCallbackUrl();
     die;
 }
开发者ID:designwall,项目名称:dw-social-login,代码行数:25,代码来源:Endpoint.php

示例7: processAuthDone

 /**
  * define:endpoint step 3.1 and 3.2
  */
 protected function processAuthDone()
 {
     $provider_id = trim($this->getProperty('hauth_done'));
     $hauth = Hybrid_Auth::setup($provider_id);
     if (!$hauth) {
         Hybrid_Logger::error("Endpoint: Invalid parameter on hauth_done!");
         $hauth->adapter->setUserUnconnected();
         header("HTTP/1.0 404 Not Found");
         return "Invalid parameter! Please return to the login page and try again.";
     }
     try {
         Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
         $hauth->adapter->loginFinish();
     } catch (Exception $e) {
         Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
         Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
         $hauth->adapter->setUserUnconnected();
     }
     Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
     // Save profile data in session
     $profile = $hauth->adapter->getUserProfile();
     // else
     $_SESSION['social_profile'] = array('provider' => $provider_id, 'profile' => $this->modx->error->toArray($profile));
     //$q->prepare();
     //$this->modx->log(1, $q->toSQL());
     // else
     $hauth->returnToCallbackUrl();
     return '';
 }
开发者ID:bendasvadim,项目名称:NewsModxBox,代码行数:32,代码来源:endpoint.class.php

示例8: hybridauth_authenticate

 /**
  * Аутентификация HybridAuth
  * @param string $provider
  * @return bool
  */
 protected function hybridauth_authenticate($provider)
 {
     global $hybridauth;
     try {
         $params = array();
         if ($provider == 'OpenID') {
             $openid_identifier = get('openid_identifier', '', 'g');
             if ($openid_identifier) {
                 $params['openid_identifier'] = $openid_identifier;
             }
         }
         $adapter = $hybridauth->authenticate($provider, $params);
         $user_profile = $adapter->getUserProfile();
         if (!$user_profile) {
             Hybrid_Error::setError("Error getUserProfile, provider=" . $provider . ". Line=" . __LINE__);
             $this->setError("error_get_profile");
             return false;
         }
         if ($this->_user) {
             // Есть текущий залогиненный пользователь, надо привязать к нему
             // Если не привязано уже к другому пользователю
             $link_user_id = (int) sql_getValue("SELECT user_id FROM {$this->_table_socials} WHERE provider='{$provider}' AND identifier='{$user_profile->identifier}'");
             if ($link_user_id && $link_user_id != $this->_user->getId()) {
                 $adapter->logout();
                 Hybrid_Error::setError("Provider={$provider}, identifier={$user_profile->identifier}: already linked to another user={$link_user_id}" . ". Line=" . __LINE__);
                 $this->setError("link_provider_error");
                 return false;
             }
             $name = '';
             if ($user_profile->firstName) {
                 $name = $user_profile->firstName;
                 if ($user_profile->lastName) {
                     $name .= ' ' . $user_profile->lastName;
                 }
             } else {
                 if ($user_profile->displayName) {
                     $name = $user_profile->displayName;
                 }
             }
             if (!$name) {
                 $name = $user_profile->identifier;
             }
             if ($name) {
                 $win1251 = iconv('utf-8', 'windows-1251', $name);
                 if ($win1251) {
                     $name = $win1251;
                 }
             }
             $this->_user->createSocialLink(array('provider' => $provider, 'identifier' => $user_profile->identifier, 'profileURL' => $user_profile->profileURL, 'photoURL' => $user_profile->photoURL, 'name' => $name));
         } else {
             // Никто не залогинен
             $user_id = sql_getValue("SELECT user_id FROM {$this->_table_socials} WHERE provider='{$provider}' AND identifier='{$user_profile->identifier}'");
             if (!$user_id) {
                 $user_id = $this->createUserByProvider($provider, $user_profile);
                 if ($user_id === false) {
                     Hybrid_Error::setError("Error create user in table {$this->_table}" . ". Line=" . __LINE__);
                     return false;
                 }
             }
             // авторизовать на сайте
             $this->login($user_id);
         }
         return true;
     } catch (Exception $e) {
         Hybrid_Error::setError($e->getMessage() . ". Line=" . __LINE__);
         $this->setError($e->getMessage());
         return false;
     }
 }
开发者ID:romlg,项目名称:cms36,代码行数:74,代码来源:auth.class.php


注:本文中的Hybrid_Error::setError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。