Esempio n. 1
0
 /**
  *  显示或跳转至认证的连接
  * @param type $type   微博类型,参见weibolib.php的TypeCheck函数
  * @param type $ifoob  是否使用oob(twitter等,需要使用这个)
  * @return WeiboController 
  */
 function authprelogin($type, $ifoob = false)
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewLayout = JRequest::getCmd('layout', 'default');
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla! 1.7
         $viewName = JRequest::getCmd('view', $this->default_view);
         $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath));
     } else {
         // Joomla! 1.5
         $viewName = JRequest::getCmd('view');
         $view = $this->getView($viewName, $viewType);
     }
     $view->return = JRequest::getCmd('rid');
     $u =& JFactory::getURI();
     $p = $u->base();
     $path = $p . '/index.php?option=com_weibo&task=' . $type . 'login' . '&rid=' . $view->return;
     $view->weibourl = AuthUrlGet($type, $path);
     if ($ifoob) {
         $view->oobprelogin();
     } else {
         $view->weiboprelogin();
     }
     return $this;
 }
    /**
     * 这个数据显示一个页面,它自动会转入腾讯授权的页面
     */
    function showTwitterAuth()
    {
        $u =& JFactory::getURI();
        $p = $u->base() . '/index.php?option=com_weibo&task=twittercallback';
        $aurl = AuthUrlGet('twitter', $p);
        if ($aurl) {
            ?>
            <a href="<?php 
            echo $aurl;
            ?>
" target="_twitter">点击这里</a>进行认证,把看到的数字填入下面的框内。<br />
            <form action="<?php 
            echo JRoute::_('index.php', true);
            ?>
"  method="post" name="ooblogin-form">
                <input type="text" name="oobpin" />
                <input type="submit" />
                <input type="hidden" name="option" value="com_weibo" />
                <input type="hidden" name="task" value="twittercallback" />
            </form>
            <?php 
        } else {
            ?>
   
            无法联系上认证服务器。请返回。<br />(认证服务器可能已经停止,或者天朝内网,无法访问Twitter。)
            <?php 
        }
    }