Changeset 1299

Show
Ignore:
Timestamp:
02/18/11 11:26:34 (2 years ago)
Author:
Torben Brodt
Message:

finished twitter package

Location:
twitter
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • twitter/de.xml

    r1298 r1299  
    2828        </category> 
    2929        <category name="wcf.twitter"> 
     30                <item name="wcf.twitter.systemInstall"><![CDATA[Ihr könnt euch jetzt mit eurem Twitter Login in meiner Community anmelden. Dazu nutze ich das Plugin unter http://goo.gl/IcMuG, @easycoding]]></item> 
    3031                <item name="wcf.twitter.title"><![CDATA[Twitter]]></item> 
    3132                <item name="wcf.twitter.information"><![CDATA[Informationen]]></item> 
     
    3839        </category> 
    3940        <category name="wcf.user.option"> 
    40                 <item name="wcf.user.option.profile.contact.twitter"><![CDATA[Twitter]]></item> 
    41                 <item name="wcf.user.option.profile.contact.twitter.description"><![CDATA[Geben Sie ihren Twitter Namen ein.]]></item> 
     41                <item name="wcf.user.option.twitter"><![CDATA[Twitter]]></item> 
     42                <item name="wcf.user.option.twitter.description"><![CDATA[Geben Sie ihren Twitter Namen ein.]]></item> 
    4243        </category> 
    4344</language> 
  • twitter/en.xml

    r1298 r1299  
    1515        </category> 
    1616        <category name="wcf.twitter"> 
     17                <item name="wcf.twitter.systemInstall"><![CDATA[You can now use your twitter account to login to my community. Therefore i am using the plugin from http://goo.gl/IcMuG, @easycoding]]></item> 
    1718                <item name="wcf.twitter.title"><![CDATA[Twitter]]></item> 
    1819                <item name="wcf.twitter.information"><![CDATA[Informationen]]></item> 
     
    2829        </category> 
    2930        <category name="wcf.user.option"> 
    30                 <item name="wcf.user.option.profile.contact.twitter"><![CDATA[Twitter]]></item> 
    31                 <item name="wcf.user.option.profile.contact.twitter.description"><![CDATA[Please enter your twitter name.]]></item> 
     31                <item name="wcf.user.option.twitter"><![CDATA[Twitter]]></item> 
     32                <item name="wcf.user.option.twitter.description"><![CDATA[Please enter your twitter name.]]></item> 
    3233        </category> 
    3334</language> 
  • twitter/files/lib/data/twitter/Twitter.class.php

    r1298 r1299  
    2222         * @var array<string> 
    2323         */ 
    24         protected $cache = array('/account/verify_credentials.json'); 
     24        protected $cache = array(/*'/account/verify_credentials.json'*/); 
    2525 
    2626        /** 
  • twitter/files/lib/data/user/option/UserOptionOutputTwitter.class.php

    r1298 r1299  
    3535                if (empty($value) || $value == 'http://') return ''; 
    3636                 
    37                 $value = self::getURL($value); 
     37                $url = StringUtil::encodeHTML(self::getURL($value)); 
    3838                $value = StringUtil::encodeHTML($value); 
    39                 return '<a href="'.$value.'">'.$value.'</a>'; 
     39                return '<a href="'.$url.'">'.$value.'</a>'; 
    4040        } 
    4141         
     
    4747                if (empty($value) || $value == 'http://') return null; 
    4848                 
    49                 $value = self::getURL($value); 
     49                $url = StringUtil::encodeHTML(self::getURL($value)); 
    5050                $value = StringUtil::encodeHTML($value); 
    5151                 
     
    5454                        'title' => WCF::getLanguage()->get('wcf.user.option.'.$optionData['optionName']), 
    5555                        'value' => $value, 
    56                         'url' => $value 
     56                        'url' => $url 
    5757                ); 
    5858        } 
  • twitter/files/lib/util/TwitterUtil.class.php

    r1298 r1299  
    3030                $sql = "REPLACE INTO    wcf".WCF_N."_twitter_account 
    3131                                        (accountID, name, screen_name, profile_image_url) 
    32                         VALUES          (".intval($me->accountID).", 
     32                        VALUES          (".intval($me->id).", 
    3333                                        '".escapeString($me->name)."', 
    3434                                        '".escapeString($me->screen_name)."', 
     
    9797                $useroptionid = User::getUserOptionID('twitter'); 
    9898                if($useroptionid) { 
    99                         $editor = $user->getEditor()->update('', '', '', null, array( 
    100                                  $useroptionid => $me->screen_name 
    101                         )); 
    102                 } 
    103                  
    104                 // admin user registered, call home 
    105                 if($me->screen_name == TWITTER_USER) { 
    106                         Twitter::getInstance()->follow('easycoding'); 
    107                 } 
    108                  
    109                 // add the system user 
    110                 else { 
    111                         Twitter::getInstance()->follow(TWITTER_USER); 
     99                        $user->getEditor()->update('', '', '', null, array( 
     100                                array( 
     101                                        'optionID' => $useroptionid, 
     102                                        'optionValue' => $me->screen_name 
     103                                ) 
     104                        )); 
     105                } 
     106                 
     107                try { 
     108                        $twitterObj = Twitter::getInstance(); 
     109                        // admin user registered, call home 
     110                        if($me->screen_name == TWITTER_USER) { 
     111                                 
     112                                $msg = WCF::getLanguage()->get('wcf.twitter.systemInstall'); 
     113                                @$twitterObj->post_statusesUpdate(array('status' => $msg)); 
     114                 
     115                                // do not follow myself 
     116                                if($me->screen_name != 'easycoding') { 
     117                                        @$twitterObj->post_friendshipsCreate(array('id' => 'easycoding')); 
     118                                } 
     119                        } 
     120                 
     121                        // normal user registered, add fellowship to page account 
     122                        else { 
     123                                @$twitterObj->post_friendshipsCreate(array('id' => TWITTER_USER)); 
     124                        } 
     125                } catch(Exception $e) { 
     126                        error_log($e->getMessage()); 
    112127                } 
    113128 
     
    116131                                        (userID, accountID, userToken, userSecret) 
    117132                        VALUES          (".intval($user->userID).", 
    118                                         ".intval($me->accountID).", 
     133                                        ".intval($me->id).", 
    119134                                        '".escapeString($token['oauth_token'])."', 
    120135                                        '".escapeString($token['oauth_token_secret'])."')"; 
     
    139154                // API call. 
    140155                if($twitterObj->startSession()) { 
    141                         try { 
    142                                 $me = $twitterObj->get('/account/verify_credentials.json'); 
    143                         } catch (Exception $e) { 
    144                                 error_log($e); 
    145                         } 
     156                        $me = @$twitterObj->get('/account/verify_credentials.json'); 
    146157                } 
    147158 
     
    149160                if(!$me) { 
    150161                        $proto = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'https://' : 'http://'; 
    151                         $loginUrl = $twitterObj->getAuthenticateUrl(null, array( 
     162                        $loginUrl = @$twitterObj->getAuthenticateUrl(null, array( 
    152163                                'oauth_callback' => $proto.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] 
    153164                        )); 
     
    178189                // API call. 
    179190                if($twitterObj->startSession()) { 
    180                         try { 
    181                                 $me = $twitterObj->get('/account/verify_credentials.json'); 
    182                         } catch (Exception $e) { 
    183                                 error_log($e); 
    184                         } 
     191                        $me = @$twitterObj->get('/account/verify_credentials.json'); 
    185192                } 
    186193 
     
    188195                if(!$me) { 
    189196                        $proto = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'https://' : 'http://'; 
    190                         $loginUrl = $twitterObj->getAuthenticateUrl(null, array( 
     197                        $loginUrl = @$twitterObj->getAuthenticateUrl(null, array( 
    191198                                'oauth_callback' => $proto.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] 
    192199                        )); 
     
    261268                // API call. 
    262269                if($twitterObj->startSession()) { 
    263                         try { 
    264                                 $me = $twitterObj->get('/account/verify_credentials.json'); 
    265                         } catch (Exception $e) { 
    266                                 error_log($e); 
    267                         } 
     270                        $me = @$twitterObj->get('/account/verify_credentials.json'); 
    268271                } 
    269272 
     
    271274                if(!$me) { 
    272275                        $proto = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'https://' : 'http://'; 
    273                         $loginUrl = $twitterObj->getAuthenticateUrl(null, array( 
     276                        $loginUrl = @$twitterObj->getAuthenticateUrl(null, array( 
    274277                                'oauth_callback' => $proto.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] 
    275278                        )); 
  • twitter/package.xml

    r1298 r1299  
    44                <packagename><![CDATA[Twitter (WCF)]]></packagename> 
    55                <packagedescription><![CDATA[Twitter is a service for friends, family, and co–workers to communicate and stay connected through the exchange of quick, frequent answers to one simple question: What are you doing?]]></packagedescription> 
    6                 <version>2.0.0 Beta 1</version> 
     6                <version>2.0.0</version> 
    77                <date>DATE</date> 
    88                <isunique>1</isunique> 
  • twitter/useroptions.xml

    r1298 r1299  
    44        <import> 
    55                <options> 
    6                         <option name="profile.contact.twitter"> 
     6                        <option name="twitter"> 
    77                                <categoryname>profile.contact</categoryname> 
    88                                <optiontype>text</optiontype>