]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'testing' into 0.9.x
authorBrion Vibber <brion@pobox.com>
Fri, 26 Feb 2010 17:35:28 +0000 (09:35 -0800)
committerBrion Vibber <brion@pobox.com>
Fri, 26 Feb 2010 17:35:28 +0000 (09:35 -0800)
36 files changed:
actions/apiaccountupdateprofile.php
actions/apigroupshow.php
actions/apioauthauthorize.php
actions/apistatusnetconfig.php
actions/confirmaddress.php
actions/othersettings.php
actions/version.php
classes/File.php
db/08to09.sql
lib/apiaction.php
lib/authenticationplugin.php
lib/command.php
lib/commandinterpreter.php
lib/default.php
lib/htmloutputter.php
lib/iomaster.php
lib/queuemanager.php
lib/subs.php
lib/util.php
plugins/Autocomplete/jquery-autocomplete/indicator.gif [new file with mode: 0644]
plugins/Comet/CometPlugin.php
plugins/Facebook/FacebookPlugin.php
plugins/Facebook/facebookaction.php
plugins/Imap/ImapPlugin.php
plugins/LdapAuthentication/LdapAuthenticationPlugin.php
plugins/Minify/MinifyPlugin.php
plugins/OStatus/OStatusPlugin.php
plugins/OpenID/OpenIDPlugin.php
plugins/Orbited/OrbitedPlugin.php
plugins/README-plugins [new file with mode: 0644]
plugins/Realtime/RealtimePlugin.php
plugins/Realtime/realtimeupdate.js
plugins/Recaptcha/RecaptchaPlugin.php
plugins/ReverseUsernameAuthentication/ReverseUsernameAuthenticationPlugin.php
plugins/TwitterBridge/twitter.php
scripts/useremail.php

index fd4384a25c465093f042cdeee6c4650ede04b245..9b371ea95764e1f829e7c9bce1eba8cffcb3859a 100644 (file)
@@ -115,11 +115,11 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
 
         $original = clone($profile);
 
-        if (empty($this->name)) {
+        if (!empty($this->name)) {
             $profile->fullname = $this->name;
         }
 
-        if (empty($this->url)) {
+        if (!empty($this->url)) {
             $profile->homepage = $this->url;
         }
 
index 95d6f95afa8a18be770d5d8a0d00225563638d16..5745a81f4172e6572694bba3b12ccb1ea638f8ed 100644 (file)
@@ -45,6 +45,7 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
  * @author   Evan Prodromou <evan@status.net>
  * @author   Jeffery To <jeffery.to@gmail.com>
  * @author   Zach Copley <zach@status.net>
+ * @author   Michele <macno@macno.org>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
@@ -68,6 +69,24 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
 
         $this->group = $this->getTargetGroup($this->arg('id'));
 
+        if (empty($this->group)) {
+            $alias = Group_alias::staticGet(
+                'alias',
+                common_canonical_nickname($this->arg('id'))
+            );
+            if (!empty($alias)) {
+                $args = array('id' => $alias->group_id, 'format' => $this->format);
+                common_redirect(common_local_url('ApiGroupShow', $args), 301);
+            } else {
+                $this->clientError(
+                    _('Group not found!'),
+                    404,
+                    $this->format
+                );
+            }
+            return;
+        }
+
         return true;
     }
 
@@ -85,15 +104,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
     {
         parent::handle($args);
 
-        if (empty($this->group)) {
-            $this->clientError(
-                _('Group not found!'),
-                404,
-                $this->format
-            );
-            return;
-        }
-
         switch($this->format) {
         case 'xml':
             $this->showSingleXmlGroup($this->group);
@@ -105,7 +115,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
             $this->clientError(_('API method not found.'), 404, $this->format);
             break;
         }
-
     }
 
     /**
index 2caa8d20b33a36ced4c703bbf66fc40c0a607799..e7c6f376116d636bdd42c05d55ecb6b00c306739 100644 (file)
@@ -156,7 +156,7 @@ class ApiOauthAuthorizeAction extends ApiOauthAction
 
                 if (!$result) {
                     common_log_db_error($appUser, 'DELETE', __FILE__);
-                    throw new ServerException(_('DB error deleting OAuth app user.'));
+                    throw new ServerException(_('Database error deleting OAuth application user.'));
                     return;
                 }
             }
@@ -182,7 +182,7 @@ class ApiOauthAuthorizeAction extends ApiOauthAction
 
             if (!$result) {
                 common_log_db_error($appUser, 'INSERT', __FILE__);
-                throw new ServerException(_('DB error inserting OAuth app user.'));
+                throw new ServerException(_('Database error inserting OAuth application user.'));
                 return;
             }
 
index 296376d1955095b7f232aa018d9d5144aaef12d8..bff8313b5c55e993165ee7a798f015ae8e6fb90f 100644 (file)
@@ -50,13 +50,17 @@ if (!defined('STATUSNET')) {
 class ApiStatusnetConfigAction extends ApiAction
 {
     var $keys = array(
-        'site' => array('name', 'server', 'theme', 'path', 'fancy', 'language',
-                        'email', 'broughtby', 'broughtbyurl', 'closed',
-                        'inviteonly', 'private'),
-        'license' => array('url', 'title', 'image'),
+        'site' => array('name', 'server', 'theme', 'path', 'logo', 'fancy', 'language',
+                        'email', 'broughtby', 'broughtbyurl', 'timezone', 'closed',
+                        'inviteonly', 'private', 'textlimit', 'ssl', 'sslserver', 'shorturllength'),
+        'license' => array('type', 'owner', 'url', 'title', 'image'),
         'nickname' => array('featured'),
+        'profile' => array('biolimit'),
+        'group' => array('desclimit'),
+        'notice' => array('contentlimit'),
         'throttle' => array('enabled', 'count', 'timespan'),
-        'xmpp' => array('enabled', 'server', 'user')
+        'xmpp' => array('enabled', 'server', 'port', 'user'),
+        'integration' => array('source')
     );
 
     /**
index 6fd74f3ff7889bf40e55d9df9343edecb0d10e6c..cc8351d8dcc0309ae593b77e120688fb571602c9 100644 (file)
@@ -141,7 +141,7 @@ class ConfirmaddressAction extends Action
 
     function title()
     {
-        return _('Confirm Address');
+        return _('Confirm address');
     }
 
     /**
index 0de7cd90860b1a7cc26198a4e033c5820bb4ef5a..10e9873b390b16f6cbc7e0d849a0c6d770a9814a 100644 (file)
@@ -57,7 +57,7 @@ class OthersettingsAction extends AccountSettingsAction
 
     function title()
     {
-        return _('Other Settings');
+        return _('Other settings');
     }
 
     /**
index c1f673c45c04844db093dccb2c7c9304c4bad3a2..b6593e5edb09cbdfe061201abf2ad13d2fcd1c49 100644 (file)
@@ -266,5 +266,6 @@ class VersionAction extends Action
                               'Craig Andrews',
                               'mEDI',
                               'Brett Taylor',
-                              'Brigitte Schuster');
+                              'Brigitte Schuster',
+                              'Brion Vibber');
 }
index 91b12d2e28664e61206aadb9abb4e8301fe21441..189e04ce021d77dc74a29ee14dbb64df118b4c2e 100644 (file)
@@ -279,6 +279,8 @@ class File extends Memcached_DataObject
                         if($oembed->modified) $enclosure->modified=$oembed->modified;
                         unset($oembed->size);
                     }
+                } else {
+                    return false;
                 }
             }
         }
index b10e47dbcb67f769f1577c046c9222e0e772c600..d5f30a26b99e449c62b9c8522ff1518bd96c8139 100644 (file)
@@ -110,3 +110,34 @@ insert into queue_item_new (frame,transport,created,claimed)
 alter table queue_item rename to queue_item_old;
 alter table queue_item_new rename to queue_item;
 
+alter table consumer
+    add column  consumer_secret varchar(255) not null comment 'secret value';
+
+create table oauth_application (
+    id integer auto_increment primary key comment 'unique identifier',
+    owner integer not null comment 'owner of the application' references profile (id),
+    consumer_key varchar(255) not null comment 'application consumer key' references consumer (consumer_key),
+    name varchar(255) not null comment 'name of the application',
+    description varchar(255) comment 'description of the application',
+    icon varchar(255) not null comment 'application icon',
+    source_url varchar(255) comment 'application homepage - used for source link',
+    organization varchar(255) comment 'name of the organization running the application',
+    homepage varchar(255) comment 'homepage for the organization',
+    callback_url varchar(255) comment 'url to redirect to after authentication',
+    type tinyint default 0 comment 'type of app, 1 = browser, 2 = desktop',
+    access_type tinyint default 0 comment 'default access type, bit 1 = read, bit 2 = write',
+    created datetime not null comment 'date this record was created',
+    modified timestamp comment 'date this record was modified'
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+
+create table oauth_application_user (
+    profile_id integer not null comment 'user of the application' references profile (id),
+    application_id integer not null comment 'id of the application' references oauth_application (id),
+    access_type tinyint default 0 comment 'access type, bit 1 = read, bit 2 = write, bit 3 = revoked',
+    token varchar(255) comment 'request or access token',
+    created datetime not null comment 'date this record was created',
+    modified timestamp comment 'date this record was modified',
+    constraint primary key (profile_id, application_id)
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+
+
index 2af150ab994d6f5bc9c60a849fadf0c7c715be41..9bfca3b66e49b643c403714c02744dd4ca0363fd 100644 (file)
@@ -289,11 +289,12 @@ class ApiAction extends Action
             $twitter_status['attachments'] = array();
 
             foreach ($attachments as $attachment) {
-                if ($attachment->isEnclosure()) {
+                $enclosure_o=$attachment->getEnclosure();
+                if ($enclosure_o) {
                     $enclosure = array();
-                    $enclosure['url'] = $attachment->url;
-                    $enclosure['mimetype'] = $attachment->mimetype;
-                    $enclosure['size'] = $attachment->size;
+                    $enclosure['url'] = $enclosure_o->url;
+                    $enclosure['mimetype'] = $enclosure_o->mimetype;
+                    $enclosure['size'] = $enclosure_o->size;
                     $twitter_status['attachments'][] = $enclosure;
                 }
             }
index de479a5768081b42648b60c219b6c1d1be51c3dc..5be3ea5b90795c360f3865e506f9f265b835135d 100644 (file)
@@ -69,13 +69,17 @@ abstract class AuthenticationPlugin extends Plugin
     /**
     * Automatically register a user when they attempt to login with valid credentials.
     * User::register($data) is a very useful method for this implementation
-    * @param username
+    * @param username username (that is used to login and find the user in the authentication provider) of the user to be registered
+    * @param nickname nickname of the user in the SN system. If nickname is null, then set nickname = username
     * @return mixed instance of User, or false (if user couldn't be created)
     */
-    function autoRegister($username)
+    function autoRegister($username, $nickname = null)
     {
+        if(is_null($nickname)){
+            $nickname = $username;
+        }
         $registration_data = array();
-        $registration_data['nickname'] = $username ;
+        $registration_data['nickname'] = $nickname ;
         return User::register($registration_data);
     }
 
@@ -92,6 +96,19 @@ abstract class AuthenticationPlugin extends Plugin
         return false;
     }
 
+    /**
+    * Given a username, suggest what the nickname should be
+    * Used during autoregistration
+    * Useful if your usernames are ugly, and you want to suggest
+    * nice looking nicknames when users initially sign on
+    * @param username
+    * @return string nickname
+    */
+    function suggestNicknameForUsername($username)
+    {
+        return $username;
+    }
+
     //------------Below are the methods that connect StatusNet to the implementing Auth plugin------------\\
     function onInitializePlugin(){
         if(!isset($this->provider_name)){
@@ -108,10 +125,22 @@ abstract class AuthenticationPlugin extends Plugin
     function onAutoRegister($nickname, $provider_name, &$user)
     {
         if($provider_name == $this->provider_name && $this->autoregistration){
-            $user = $this->autoregister($nickname);
-            if($user){
-                User_username::register($user,$nickname,$this->provider_name);
-                return false;
+            $suggested_nickname = $this->suggestNicknameForUsername($nickname);
+            $test_user = User::staticGet('nickname', $suggested_nickname);
+            if($test_user) {
+                //someone already exists with the suggested nickname, so used the passed nickname
+                $suggested_nickname = $nickname;
+            }
+            $test_user = User::staticGet('nickname', $suggested_nickname);
+            if($test_user) {
+                //someone already exists with the suggested nickname
+                //not much else we can do
+            }else{
+                $user = $this->autoRegister($nickname, $suggested_nickname);
+                if($user){
+                    User_username::register($user,$nickname,$this->provider_name);
+                    return false;
+                }
             }
         }
     }
@@ -122,23 +151,30 @@ abstract class AuthenticationPlugin extends Plugin
         $user_username->username=$nickname;
         $user_username->provider_name=$this->provider_name;
         if($user_username->find() && $user_username->fetch()){
-            $username = $user_username->username;
-            $authenticated = $this->checkPassword($username, $password);
+            $authenticated = $this->checkPassword($user_username->username, $password);
             if($authenticated){
                 $authenticatedUser = User::staticGet('id', $user_username->user_id);
                 return false;
             }
         }else{
-            $user = User::staticGet('nickname', $nickname);
+            //$nickname is the username used to login
+            //$suggested_nickname is the nickname the auth provider suggests for that username
+            $suggested_nickname = $this->suggestNicknameForUsername($nickname);
+            $user = User::staticGet('nickname', $suggested_nickname);
             if($user){
-                //make sure a different provider isn't handling this nickname
+                //make sure this user isn't claimed
                 $user_username = new User_username();
-                $user_username->username=$nickname;
-                if(!$user_username->find()){
-                    //no other provider claims this username, so it's safe for us to handle it
+                $user_username->user_id=$user->id;
+                $we_can_handle = false;
+                if($user_username->find()){
+                    //either this provider, or another one, has already claimed this user
+                    //so we cannot. Let another plugin try.
+                    return;
+                }else{
+                    //no other provider claims this user, so it's safe for us to handle it
                     $authenticated = $this->checkPassword($nickname, $password);
                     if($authenticated){
-                        $authenticatedUser = User::staticGet('nickname', $nickname);
+                        $authenticatedUser = $user;
                         User_username::register($authenticatedUser,$nickname,$this->provider_name);
                         return false;
                     }
index ea7b60372d96542dd134069d7a94b67b4d40756c..db8e8003041f0d2cdfc35cc10d8a259b42364e7a 100644 (file)
@@ -668,6 +668,34 @@ class LoginCommand extends Command
     }
 }
 
+class LoseCommand extends Command
+{
+
+    var $other = null;
+
+    function __construct($user, $other)
+    {
+        parent::__construct($user);
+        $this->other = $other;
+    }
+
+    function execute($channel)
+    {
+        if(!$this->other) {
+            $channel->error($this->user, _('Specify the name of the user to unsubscribe from'));
+            return;
+        }
+
+        $result=subs_unsubscribe_from($this->user, $this->other);
+
+        if ($result) {
+            $channel->output($this->user, sprintf(_('Unsubscribed  %s'), $this->other));
+        } else {
+            $channel->error($this->user, $result);
+        }
+    }
+}
+
 class SubscriptionsCommand extends Command
 {
     function execute($channel)
@@ -750,6 +778,7 @@ class HelpCommand extends Command
                            "d <nickname> <text> - direct message to user\n".
                            "get <nickname> - get last notice from user\n".
                            "whois <nickname> - get profile info on user\n".
+                           "lose <nickname> - force user to stop following you\n".
                            "fav <nickname> - add user's last notice as a 'fave'\n".
                            "fav #<notice_id> - add notice with the given id as a 'fave'\n".
                            "repeat #<notice_id> - repeat a notice with a given id\n".
index c2add7299e7330287303374944d912caa753dc09..fbc6174bbfab1b95a2d9573df2043e3688cf9a0f 100644 (file)
@@ -47,6 +47,17 @@ class CommandInterpreter
             } else {
                 return new LoginCommand($user);
             }
+         case 'lose':
+            if ($arg) {
+                list($other, $extra) = $this->split_arg($arg);
+                if ($extra) {
+                    return null;
+                } else {
+                    return new LoseCommand($user, $other);
+                }
+            } else {
+              return null;
+            }
          case 'subscribers':
             if ($arg) {
                 return null;
index d849055c213287b968da6b303ca6ec924815b2d3..b06b9615762072721ed31d8b30f08248a1b6d1af 100644 (file)
@@ -279,6 +279,7 @@ $default =
                                  'Geonames' => null,
                                  'Mapstraction' => null,
                                  'WikiHashtags' => null,
+                                 'RSSCloud' => null,
                                  'OpenID' => null),
               ),
         'admin' =>
index 7315fe2ad44d34c43c107af91da9bbaa6e6c595e..7786b5941e25ba770d3f11c029f360af5b322f50 100644 (file)
@@ -356,40 +356,47 @@ class HTMLOutputter extends XMLOutputter
 
             if( empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment']))
             {
-                $path = common_config('javascript', 'path');
+                if (strpos($src, 'plugins/') === 0 || strpos($src, 'local/') === 0) {
 
-                if (empty($path)) {
-                    $path = common_config('site', 'path') . '/js/';
-                }
+                    $src = common_path($src) . '?version=' . STATUSNET_VERSION;
 
-                if ($path[strlen($path)-1] != '/') {
-                    $path .= '/';
-                }
+                }else{
 
-                if ($path[0] != '/') {
-                    $path = '/'.$path;
-                }
+                    $path = common_config('javascript', 'path');
 
-                $server = common_config('javascript', 'server');
+                    if (empty($path)) {
+                        $path = common_config('site', 'path') . '/js/';
+                    }
 
-                if (empty($server)) {
-                    $server = common_config('site', 'server');
-                }
+                    if ($path[strlen($path)-1] != '/') {
+                        $path .= '/';
+                    }
 
-                $ssl = common_config('javascript', 'ssl');
+                    if ($path[0] != '/') {
+                        $path = '/'.$path;
+                    }
+
+                    $server = common_config('javascript', 'server');
 
-                if (is_null($ssl)) { // null -> guess
-                    if (common_config('site', 'ssl') == 'always' &&
-                        !common_config('javascript', 'server')) {
-                        $ssl = true;
-                    } else {
-                        $ssl = false;
+                    if (empty($server)) {
+                        $server = common_config('site', 'server');
                     }
-                }
 
-                $protocol = ($ssl) ? 'https' : 'http';
+                    $ssl = common_config('javascript', 'ssl');
 
-                $src = $protocol.'://'.$server.$path.$src . '?version=' . STATUSNET_VERSION;
+                    if (is_null($ssl)) { // null -> guess
+                        if (common_config('site', 'ssl') == 'always' &&
+                            !common_config('javascript', 'server')) {
+                            $ssl = true;
+                        } else {
+                            $ssl = false;
+                        }
+                    }
+
+                    $protocol = ($ssl) ? 'https' : 'http';
+
+                    $src = $protocol.'://'.$server.$path.$src . '?version=' . STATUSNET_VERSION;
+                }
             }
 
             $this->element('script', array('type' => $type,
index d20837ba54a3dac70e5731a2eb1b705912beb8ac..7cfb2c9a0ff18c59039cfdae634c728ec9fc8282 100644 (file)
@@ -330,7 +330,7 @@ abstract class IoMaster
      * for per-queue and per-site records.
      *
      * @param string $key counter name
-     * @param array $owners list of owner keys like 'queue:jabber' or 'site:stat01'
+     * @param array $owners list of owner keys like 'queue:xmpp' or 'site:stat01'
      */
     public function stats($key, $owners=array())
     {
index 9fdc801100f46f58df9e9ab22c71529da55af6bd..87bd356aa2b0d7ea43c959513bda4e0001958884 100644 (file)
@@ -213,7 +213,9 @@ abstract class QueueManager extends IoManager
     {
         if (isset($this->handlers[$queue])) {
             $class = $this->handlers[$queue];
-            if (class_exists($class)) {
+            if(is_object($class)) {
+                return $class;
+            } else if (class_exists($class)) {
                 return new $class();
             } else {
                 $this->_log(LOG_ERR, "Nonexistent handler class '$class' for queue '$queue'");
@@ -286,7 +288,7 @@ abstract class QueueManager extends IoManager
      * Only registered transports will be reliably picked up!
      *
      * @param string $transport
-     * @param string $class
+     * @param string $class class name or object instance
      * @param string $group
      */
     public function connect($transport, $class, $group='main')
index 1c240c475d40c7f71fd428de44eec07499dc3baa..e2ce0667eb19f78e3c2e9f5aed9fb0fdcc76df47 100644 (file)
@@ -42,4 +42,47 @@ function subs_unsubscribe_to($user, $other)
     } catch (Exception $e) {
         return $e->getMessage();
     }
-}
\ No newline at end of file
+}
+
+function subs_unsubscribe_from($user, $other){
+   $local = User::staticGet("nickname",$other);
+   if($local){
+     return subs_unsubscribe_to($local,$user);
+   } else {
+    try {
+        $remote = Profile::staticGet("nickname",$other);
+        if(is_string($remote)){
+          return $remote;
+        }
+        if (Event::handle('StartUnsubscribe', array($remote,$user))) {
+
+            $sub = DB_DataObject::factory('subscription');
+
+            $sub->subscriber = $remote->id;
+            $sub->subscribed = $user->id;
+
+            $sub->find(true);
+
+            // note we checked for existence above
+
+            if (!$sub->delete())
+              return _('Couldn\'t delete subscription.');
+
+            $cache = common_memcache();
+
+            if ($cache) {
+                $cache->delete(common_cache_key('user:notices_with_friends:' . $remote->id));
+            }
+
+
+            $user->blowSubscribersCount();
+            $remote->blowSubscribersCount();
+
+            Event::handle('EndUnsubscribe', array($remote, $user));
+        }
+    } catch (Exception $e) {
+        return $e->getMessage();
+    }
+   }
+}
+
index 8381bc63c0da254706de3129750fc83cbab5b2f6..1231f4c8d1cd3dd9ef39973c2f4c65e28575a189 100644 (file)
@@ -731,20 +731,13 @@ function common_linkify($url) {
     }
 
     if (!empty($f)) {
-        if ($f->isEnclosure()) {
+        if ($f->getEnclosure()) {
             $is_attachment = true;
             $attachment_id = $f->id;
-        } else {
-            $foe = File_oembed::staticGet('file_id', $f->id);
-            if (!empty($foe)) {
-                // if it has OEmbed info, it's an attachment, too
-                $is_attachment = true;
-                $attachment_id = $f->id;
-
-                $thumb = File_thumbnail::staticGet('file_id', $f->id);
-                if (!empty($thumb)) {
-                    $has_thumb = true;
-                }
+
+            $thumb = File_thumbnail::staticGet('file_id', $f->id);
+            if (!empty($thumb)) {
+                $has_thumb = true;
             }
         }
     }
diff --git a/plugins/Autocomplete/jquery-autocomplete/indicator.gif b/plugins/Autocomplete/jquery-autocomplete/indicator.gif
new file mode 100644 (file)
index 0000000..d0bce15
Binary files /dev/null and b/plugins/Autocomplete/jquery-autocomplete/indicator.gif differ
index 300d1e9a2488e7430becd87e7c5f0a95cafae092..29cb3004bf95df1ecb8543002b273aaca258e4b7 100644 (file)
@@ -68,7 +68,7 @@ class CometPlugin extends RealtimePlugin
         $ours = array('jquery.comet.js', 'cometupdate.js');
 
         foreach ($ours as $script) {
-            $scripts[] = common_path('plugins/Comet/'.$script);
+            $scripts[] = 'plugins/Comet/'.$script;
         }
 
         return $scripts;
index 4266b886d9cae1c9e9162e692de4fe5b9004ba13..78c9054e14818c1444e4d39e0173b2424b03a5e3 100644 (file)
@@ -181,7 +181,7 @@ class FacebookPlugin extends Plugin
         if ($this->reqFbScripts($action)) {
 
             $apikey      = common_config('facebook', 'apikey');
-            $plugin_path = common_path('plugins/Facebook');
+            $plugin_path = 'plugins/Facebook';
 
             $login_url  = common_local_url('FBConnectAuth');
             $logout_url = common_local_url('logout');
index 8437a705a7b7858ce5f4ecc416843ddd15182da2..f65b97c865587d10b675be04b558344b8fa3a936 100644 (file)
@@ -89,7 +89,7 @@ class FacebookAction extends Action
 
     function showScripts()
     {
-        $this->script(common_path('plugins/Facebook/facebookapp.js'));
+        $this->script('plugins/Facebook/facebookapp.js');
     }
 
     /**
index 89a775a16adbf0ff20427994ed1338e444a7a6aa..d1e920b009111d42f40f565bda2413beadc452d1 100644 (file)
@@ -86,7 +86,7 @@ class ImapPlugin extends Plugin
         }
     }
 
-    function onStartIoManagerClasses(&$classes)
+    function onStartQueueDaemonIoManagers(&$classes)
     {
         $classes[] = new ImapManager($this);
     }
index eb3a05117a4c72e2440190fce1dd8f90c7ffa87d..768f0fe7f6ea9353015d7a1102e8c4a92f3c189b 100644 (file)
@@ -96,8 +96,11 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
         }
     }
 
-    function autoRegister($username)
+    function autoRegister($username, $nickname)
     {
+        if(is_null($nickname)){
+            $nickname = $username;
+        }
         $entry = $this->ldap_get_user($username,$this->attributes);
         if($entry){
             $registration_data = array();
@@ -107,6 +110,7 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
             if(isset($registration_data['email']) && !empty($registration_data['email'])){
                 $registration_data['email_confirmed']=true;
             }
+            $registration_data['nickname'] = $nickname;
             //set the database saved password to a random string.
             $registration_data['password']=common_good_rand(16);
             return User::register($registration_data);
@@ -153,6 +157,22 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
 
         return false;
     }
+
+    function suggestNicknameForUsername($username)
+    {
+        $entry = $this->ldap_get_user($username, $this->attributes);
+        if(!$entry){
+            //this really shouldn't happen
+            return $username;
+        }else{
+            $nickname = $entry->getValue($this->attributes['nickname'],'single');
+            if($nickname){
+                return $nickname;
+            }else{
+                return $username;
+            }
+        }
+    }
     
     //---utility functions---//
     function ldap_get_config(){
index fe1883ded484082b4133de9e10b97da64b5ca92c..69def60641d778decdf5e3ba8bf7e3cbed2633f9 100644 (file)
@@ -86,7 +86,11 @@ class MinifyPlugin extends Plugin
         $url = parse_url($src);
         if( empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment']))
         {
-            $src = $this->minifyUrl($src);
+            if (strpos($src, 'plugins/') === 0 || strpos($src, 'local/') === 0) {
+                $src = $this->minifyUrl($src);
+            } else {
+                $src = $this->minifyUrl('js/'.$src);
+            }
         }
     }
 
index 46f986682afe28e00c39f2861051f3bc2370209c..543944454952cf6e64b07fe6ff6487bb5c870bdc 100644 (file)
@@ -283,12 +283,12 @@ class OStatusPlugin extends Plugin
     }
 
     function onEndShowStatusNetStyles($action) {
-        $action->cssLink(common_path('plugins/OStatus/theme/base/css/ostatus.css'));
+        $action->cssLink('plugins/OStatus/theme/base/css/ostatus.css');
         return true;
     }
 
     function onEndShowStatusNetScripts($action) {
-        $action->script(common_path('plugins/OStatus/js/ostatus.js'));
+        $action->script('plugins/OStatus/js/ostatus.js');
         return true;
     }
 
index 248afe3fa88e92e32c2782c5c907b45055345530..6b35ec3e142f2f1503f7df6476e94691fb1d1d2f 100644 (file)
@@ -235,9 +235,14 @@ class OpenIDPlugin extends Plugin
         switch ($name)
         {
          case 'register':
-            $instr = '(Have an [OpenID](http://openid.net/)? ' .
-              'Try our [OpenID registration]'.
-              '(%%action.openidlogin%%)!)';
+            if (common_logged_in()) {
+                $instr = '(Have an [OpenID](http://openid.net/)? ' .
+                  '[Add an OpenID to your account](%%action.openidsettings%%)!';
+            } else {
+                $instr = '(Have an [OpenID](http://openid.net/)? ' .
+                  'Try our [OpenID registration]'.
+                  '(%%action.openidlogin%%)!)';
+            }
             break;
          case 'login':
             $instr = '(Have an [OpenID](http://openid.net/)? ' .
index ba87b266a03b2588cb62988531838dce483693c0..8af71af747246419595971f272d756128673d795 100644 (file)
@@ -77,9 +77,9 @@ class OrbitedPlugin extends RealtimePlugin
         $root = 'http://'.$server.(($port == 80) ? '':':'.$port);
 
         $scripts[] = $root.'/static/Orbited.js';
-        $scripts[] = common_path('plugins/Orbited/orbitedextra.js');
+        $scripts[] = 'plugins/Orbited/orbitedextra.js';
         $scripts[] = $root.'/static/protocols/stomp/stomp.js';
-        $scripts[] = common_path('plugins/Orbited/orbitedupdater.js');
+        $scripts[] = 'plugins/Orbited/orbitedupdater.js';
 
         return $scripts;
     }
diff --git a/plugins/README-plugins b/plugins/README-plugins
new file mode 100644 (file)
index 0000000..cdce7eb
--- /dev/null
@@ -0,0 +1,21 @@
+Several example plugins are included in the plugins/ directory. You
+can enable a plugin with the following line in config.php:
+
+    addPlugin('Example', array('param1' => 'value1',
+                               'param2' => 'value2'));
+
+This will look for and load files named 'ExamplePlugin.php' or
+'Example/ExamplePlugin.php' either in the plugins/ directory (for
+plugins that ship with StatusNet) or in the local/ directory (for
+plugins you write yourself or that you get from somewhere else) or
+local/plugins/.
+
+Plugins are documented in their own directories.
+
+
+Additional information on using and developing plugins can be found
+on the StatusNet wiki:
+
+http://status.net/wiki/Plugins
+http://status.net/wiki/Plugin_development
+
index 2b3cb35f1d370dcc8b3b6c5421b3129956bcd032..b559d80c605a540aa333299fb3e25deb998a0f35 100644 (file)
@@ -117,7 +117,7 @@ class RealtimePlugin extends Plugin
 
     function onEndShowStatusNetStyles($action)
     {
-        $action->cssLink(common_path('plugins/Realtime/realtimeupdate.css'),
+        $action->cssLink('plugins/Realtime/realtimeupdate.css',
                          null, 'screen, projection, tv');
         return true;
     }
@@ -305,7 +305,7 @@ class RealtimePlugin extends Plugin
 
     function _getScripts()
     {
-        return array(common_path('plugins/Realtime/realtimeupdate.js'));
+        return array('plugins/Realtime/realtimeupdate.js');
     }
 
     function _updateInitialize($timeline, $user_id)
index 2e5851ae531e539dc07f85a0d0eab80915a87fc8..0f7a680d73c8e41d9aa6e509cb0188765abe5c60 100644 (file)
@@ -130,7 +130,7 @@ RealtimeUpdate = {
           user = data['user'];
           html = data['html'].replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&quot;/g,'"').replace(/&amp;/g,'&');
           source = data['source'].replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&quot;/g,'"').replace(/&amp;/g,'&');
-
+console.log(data);
           ni = "<li class=\"hentry notice\" id=\"notice-"+unique+"\">"+
                "<div class=\"entry-title\">"+
                "<span class=\"vcard author\">"+
index 3665214f85710c603f811763c78e08a7e7afe5e1..c585da43c4eceefbee2db7039c1babc36480d971 100644 (file)
@@ -31,8 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
-define('RECAPTCHA', '0.2');
-
 require_once(INSTALLDIR.'/plugins/Recaptcha/recaptchalib.php');
 
 class RecaptchaPlugin extends Plugin
@@ -88,4 +86,16 @@ class RecaptchaPlugin extends Plugin
             return false;
         }
     }
+
+    function onPluginVersion(&$versions)
+    {
+        $versions[] = array('name' => 'Recaptcha',
+                            'version' => STATUSNET_VERSION,
+                            'author' => 'Eric Helgeson',
+                            'homepage' => 'http://status.net/wiki/Plugin:Recaptcha',
+                            'rawdescription' =>
+                            _m('Uses <a href="http://recaptcha.org/">Recaptcha</a> service to add a  '.
+                               'captcha to the registration page.'));
+        return true;
+    }
 }
index d9d2137f827dded3ade0f7ee6b2de6160a3f2679..dac5a158841a77a483fdd488f852b39dd6a1567a 100644 (file)
@@ -47,10 +47,13 @@ class ReverseUsernameAuthenticationPlugin extends AuthenticationPlugin
         return $username == strrev($password);
     }
 
-    function autoRegister($username)
+    function autoRegister($username, $nickname)
     {
+        if(is_null($nickname)){
+            $nickname = $username;
+        }
         $registration_data = array();
-        $registration_data['nickname'] = $username ;
+        $registration_data['nickname'] = $nickname ;
         return User::register($registration_data);
     }
 
index ceb83b037f23dc714b02fe6cda5b2b6bd3d0c616..13e499d65eda5bba9e45c272e76555698706f91b 100644 (file)
@@ -252,8 +252,17 @@ function format_status($notice)
     $statustxt = preg_replace('/^@/', ' @', $notice->content);
 
     // Convert !groups to #hashes
+
+    // XXX: Make this an optional setting?
+
     $statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt);
 
+    if (mb_strlen($statustxt) > 140) {
+        $noticeUrl = common_shorten_url($notice->uri);
+        $urlLen = mb_strlen($noticeUrl);
+        $statustxt = mb_substr($statustxt, 0, 140 - ($urlLen + 3)) . ' … ' . $noticeUrl;
+    }
+
     return $statustxt;
 }
 
index 6676a87c803d5edfccd8bb05a94e27277adf25ce..0a59d36f83fbcad75d1bb0f9ed22042a65c2c6ac 100755 (executable)
@@ -53,7 +53,17 @@ if (have_option('i', 'id')) {
 
 if (!empty($user)) {
     if (empty($user->email)) {
-        print "No email registered for user '$user->nickname'\n";
+        # Check for unconfirmed emails
+        $unconfirmed_email = new Confirm_address();
+        $unconfirmed_email->user_id = $user->id;
+        $unconfirmed_email->address_type = 'email';
+        $unconfirmed_email->find(true);
+
+        if (empty($unconfirmed_email->address)) {
+            print "No email registered for user '$user->nickname'\n";
+        } else {
+            print "Unconfirmed Adress: $unconfirmed_email->address\n";
+        }
     } else {
         print "$user->email\n";
     }
@@ -65,7 +75,18 @@ if (have_option('e', 'email')) {
     $user->email = get_option_value('e', 'email');
     $user->find(false);
     if (!$user->fetch()) {
-        print "No users with email $user->email\n";
+        # Check unconfirmed emails
+        $unconfirmed_email = new Confirm_address();
+        $unconfirmed_email->address = $user->email;
+        $unconfirmed_email->address_type = 'email';
+        $unconfirmed_email->find(true);
+
+        if (empty($unconfirmed_email->user_id)) {
+            print "No users with email $user->email\n";
+        } else {
+            $user=User::staticGet('id', $unconfirmed_email->user_id);
+            print "Unconfirmed Address: $user->id $user->nickname\n";
+        }
         exit(0);
     }
     do {