當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Horde::signQueryString方法代碼示例

本文整理匯總了PHP中Horde::signQueryString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Horde::signQueryString方法的具體用法?PHP Horde::signQueryString怎麽用?PHP Horde::signQueryString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Horde的用法示例。


在下文中一共展示了Horde::signQueryString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display

 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     global $injector, $notification, $page_output, $prefs, $registry;
     try {
         $facebook = $injector->getInstance('Horde_Service_Facebook');
     } catch (Horde_Exception $e) {
         return $e->getMessage();
     }
     $page_output->addThemeStylesheet('facebook.css');
     $view = new Horde_View(array('templatePath' => HORDE_TEMPLATES . '/prefs'));
     $view->app_name = $registry->get('name', 'horde');
     // Ensure we have authorized horde.
     try {
         $session_uid = $facebook->auth->getLoggedInUser();
         $fbp = unserialize($prefs->getValue('facebook'));
         $uid = $fbp['uid'];
         // Verify the userid matches the one we expect for the session
         if ($fbp['uid'] != $session_uid) {
             $haveSession = false;
         } else {
             $haveSession = true;
         }
     } catch (Horde_Service_Facebook_Exception $e) {
         Horde::log($e->getMessage(), 'ERR');
         $haveSession = false;
         $prefs->setValue('facebook', serialize(array('uid' => '', 'sid' => 0)));
     }
     // Get a token generator
     $token = $injector->getInstance('Horde_Token');
     // We have a session, build the template.
     if (!empty($haveSession)) {
         try {
             $perms = $facebook->users->getAppPermissions();
             $view->have_publish = !empty($perms[Horde_Service_Facebook_Auth::EXTEND_PERMS_PUBLISHSTREAM]);
             $view->have_read = !empty($perms[Horde_Service_Facebook_Auth::EXTEND_PERMS_READSTREAM]);
             $view->have_friends = !empty($perms[Horde_Service_Facebook_Auth::EXTEND_PERMS_FRIENDS_ABOUT]);
         } catch (Horde_Service_Facebook_Exception $e) {
             $notification->push($e->getMessage(), 'horde.error');
         }
         // Get user info. FB recommends using the FB photo and styling.
         $fql = 'SELECT first_name, last_name, status, pic_with_logo, current_location FROM user WHERE uid IN (' . $uid . ')';
         try {
             $user_info = $facebook->fql->run($fql);
         } catch (Horde_Service_Facebook_Exception $e) {
             $notification->push(_("Temporarily unable to connect with Facebook, Please try again."), 'horde.alert');
         }
         // Get a state token.
         $state = $token->get();
         // FB Perms links
         $cburl = Horde::url('services/facebook', true);
         $view->have_session = true;
         $view->user_pic_url = $user_info[0]['pic_with_logo'];
         $view->user_name = $user_info[0]['first_name'] . ' ' . $user_info[0]['last_name'];
         $url = $facebook->auth->getOAuthUrl($cburl, array(Horde_Service_Facebook_Auth::EXTEND_PERMS_PUBLISHSTREAM));
         $view->publish_url = $url;
         // User read perms
         $url = $facebook->auth->getOAuthUrl($cburl, array(Horde_Service_Facebook_Auth::EXTEND_PERMS_READSTREAM, Horde_Service_Facebook_Auth::EXTEND_PERMS_USER_ABOUT, Horde_Service_Facebook_Auth::EXTEND_PERMS_USER_BIRTHDAY, Horde_Service_Facebook_Auth::EXTEND_PERMS_USER_EVENTS, Horde_Service_Facebook_Auth::EXTEND_PERMS_USER_HOMETOWN, Horde_Service_Facebook_Auth::EXTEND_PERMS_USER_LOCATION, Horde_Service_Facebook_Auth::EXTEND_PERMS_USER_PHOTOS), $state);
         $view->read_url = Horde::signQueryString($url);
         // Friend read perms
         $url = $facebook->auth->getOAuthUrl($cburl, array(Horde_Service_Facebook_Auth::EXTEND_PERMS_FRIENDS_ABOUT, Horde_Service_Facebook_Auth::EXTEND_PERMS_FRIENDS_BIRTHDAY, Horde_Service_Facebook_Auth::EXTEND_PERMS_FRIENDS_HOMETOWN, Horde_Service_Facebook_Auth::EXTEND_PERMS_FRIENDS_LOCATION, Horde_Service_Facebook_Auth::EXTEND_PERMS_FRIENDS_PHOTOS), $state);
         $view->friends_url = Horde::signQueryString($url);
     } else {
         /* No existing session */
         $state = $token->get();
         $view->authUrl = $facebook->auth->getOAuthUrl(Horde::url('services/facebook', true), array(), $state);
     }
     return $view->render('facebook');
 }
開發者ID:DSNS-LAB,項目名稱:Dmail,代碼行數:70,代碼來源:Facebook.php


注:本文中的Horde::signQueryString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。