]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
fix merge conflict 0.7.x 0.8.x in util.php and register.php.
authorRobin Millette <millette@controlyourself.ca>
Fri, 17 Apr 2009 17:04:05 +0000 (17:04 +0000)
committerRobin Millette <millette@controlyourself.ca>
Fri, 17 Apr 2009 17:04:05 +0000 (17:04 +0000)
15 files changed:
README
actions/grouprss.php
actions/profilesettings.php
actions/register.php
actions/showgroup.php
js/util.js
lib/personalgroupnav.php
lib/searchaction.php
lib/tagcloudsection.php [deleted file]
lib/twitterapi.php
lib/util.php
scripts/jabberqueuehandler.php
scripts/publicqueuehandler.php
scripts/xmppconfirmhandler.php
scripts/xmppdaemon.php

diff --git a/README b/README
index 29a1e157ad044730a2e5b674f1c41c4b4a2fa984..4f93829601e267c2a381cbdf6bc068008c295aea 100644 (file)
--- a/README
+++ b/README
@@ -1133,6 +1133,9 @@ welcome: nickname of a user account that sends welcome messages to new
          busy servers it may be a good idea to keep that one just for
          'urgent' messages. Default is null; no message.
 
+If either of these special user accounts are specified, the users should
+be created before the configuration is updated.
+
 Troubleshooting
 ===============
 
index a9a2eef877c442396424ada89c55eab7289e27b8..0b7280a11c33648584096b95176eafb63fea7835 100644 (file)
@@ -34,7 +34,7 @@ if (!defined('LACONICA')) {
 
 require_once INSTALLDIR.'/lib/rssaction.php';
 
-define('MEMBERS_PER_SECTION', 81);
+define('MEMBERS_PER_SECTION', 27);
 
 /**
  * Group RSS feed
index 60f7c0796e2c64246f9064c25db02d70e4361016..fb847680b9c158e85dc319d89029933edddabc2d 100644 (file)
@@ -91,67 +91,68 @@ class ProfilesettingsAction extends AccountSettingsAction
         $this->element('legend', null, _('Profile information'));
         $this->hidden('token', common_session_token());
 
-        # too much common patterns here... abstractable?
-
+        // too much common patterns here... abstractable?
         $this->elementStart('ul', 'form_data');
-        $this->elementStart('li');
-        $this->input('nickname', _('Nickname'),
-                     ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
-                     _('1-64 lowercase letters or numbers, no punctuation or spaces'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->input('fullname', _('Full name'),
-                     ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->input('homepage', _('Homepage'),
-                     ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
-                     _('URL of your homepage, blog, or profile on another site'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->textarea('bio', _('Bio'),
-                        ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
-                        _('Describe yourself and your interests in 140 chars'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->input('location', _('Location'),
-                     ($this->arg('location')) ? $this->arg('location') : $profile->location,
-                     _('Where you are, like "City, State (or Region), Country"'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->input('tags', _('Tags'),
-                     ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
-                     _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $language = common_language();
-        $this->dropdown('language', _('Language'),
-                        get_nice_language_list(), _('Preferred language'),
-                        true, $language);
-        $this->elementEnd('li');
-        $timezone = common_timezone();
-        $timezones = array();
-        foreach(DateTimeZone::listIdentifiers() as $k => $v) {
-            $timezones[$v] = $v;
+        if (Event::handle('StartProfileFormData', array($this))) {
+            $this->elementStart('li');
+            $this->input('nickname', _('Nickname'),
+                         ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
+                         _('1-64 lowercase letters or numbers, no punctuation or spaces'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->input('fullname', _('Full name'),
+                         ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->input('homepage', _('Homepage'),
+                         ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
+                         _('URL of your homepage, blog, or profile on another site'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->textarea('bio', _('Bio'),
+                            ($this->arg('bio')) ? $this->arg('bio') : $profile->bio,
+                            _('Describe yourself and your interests in 140 chars'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->input('location', _('Location'),
+                         ($this->arg('location')) ? $this->arg('location') : $profile->location,
+                         _('Where you are, like "City, State (or Region), Country"'));
+            $this->elementEnd('li');
+            Event::handle('EndProfileFormData', array($this));
+            $this->elementStart('li');
+            $this->input('tags', _('Tags'),
+                         ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
+                         _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $language = common_language();
+            $this->dropdown('language', _('Language'),
+                            get_nice_language_list(), _('Preferred language'),
+                            false, $language);
+            $this->elementEnd('li');
+            $timezone = common_timezone();
+            $timezones = array();
+            foreach(DateTimeZone::listIdentifiers() as $k => $v) {
+                $timezones[$v] = $v;
+            }
+            $this->elementStart('li');
+            $this->dropdown('timezone', _('Timezone'),
+                            $timezones, _('What timezone are you normally in?'),
+                            true, $timezone);
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->checkbox('autosubscribe',
+                            _('Automatically subscribe to whoever '.
+                              'subscribes to me (best for non-humans)'),
+                            ($this->arg('autosubscribe')) ?
+                            $this->boolean('autosubscribe') : $user->autosubscribe);
+            $this->elementEnd('li');
         }
-        $this->elementStart('li');
-        $this->dropdown('timezone', _('Timezone'),
-                        $timezones, _('What timezone are you normally in?'),
-                        true, $timezone);
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->checkbox('autosubscribe',
-                        _('Automatically subscribe to whoever '.
-                          'subscribes to me (best for non-humans)'),
-                        ($this->arg('autosubscribe')) ?
-                        $this->boolean('autosubscribe') : $user->autosubscribe);
-        $this->elementEnd('li');
         $this->elementEnd('ul');
         $this->submit('save', _('Save'));
 
         $this->elementEnd('fieldset');
         $this->elementEnd('form');
-
     }
 
     /**
@@ -165,158 +166,158 @@ class ProfilesettingsAction extends AccountSettingsAction
 
     function handlePost()
     {
-        # CSRF protection
-
+        // CSRF protection
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
             $this->showForm(_('There was a problem with your session token. '.
-                               'Try again, please.'));
+                        'Try again, please.'));
             return;
         }
 
-        $nickname = $this->trimmed('nickname');
-        $fullname = $this->trimmed('fullname');
-        $homepage = $this->trimmed('homepage');
-        $bio = $this->trimmed('bio');
-        $location = $this->trimmed('location');
-        $autosubscribe = $this->boolean('autosubscribe');
-        $language = $this->trimmed('language');
-        $timezone = $this->trimmed('timezone');
-        $tagstring = $this->trimmed('tags');
-
-        # Some validation
-
-        if (!Validate::string($nickname, array('min_length' => 1,
-                                               'max_length' => 64,
-                                               'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
-            $this->showForm(_('Nickname must have only lowercase letters and numbers and no spaces.'));
-            return;
-        } else if (!User::allowed_nickname($nickname)) {
-            $this->showForm(_('Not a valid nickname.'));
-            return;
-        } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
-                   !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
-            $this->showForm(_('Homepage is not a valid URL.'));
-            return;
-        } else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
-            $this->showForm(_('Full name is too long (max 255 chars).'));
-            return;
-        } else if (!is_null($bio) && mb_strlen($bio) > 140) {
-            $this->showForm(_('Bio is too long (max 140 chars).'));
-            return;
-        } else if (!is_null($location) && mb_strlen($location) > 255) {
-            $this->showForm(_('Location is too long (max 255 chars).'));
-            return;
-        }  else if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) {
-            $this->showForm(_('Timezone not selected.'));
-            return;
-        } else if ($this->nicknameExists($nickname)) {
-            $this->showForm(_('Nickname already in use. Try another one.'));
-            return;
-        } else if (!is_null($language) && strlen($language) > 50) {
-            $this->showForm(_('Language is too long (max 50 chars).'));
-            return;
-        }
+        if (Event::handle('StartProfileSaveForm', array($this))) {
+
+            $nickname = $this->trimmed('nickname');
+            $fullname = $this->trimmed('fullname');
+            $homepage = $this->trimmed('homepage');
+            $bio = $this->trimmed('bio');
+            $location = $this->trimmed('location');
+            $autosubscribe = $this->boolean('autosubscribe');
+            $language = $this->trimmed('language');
+            $timezone = $this->trimmed('timezone');
+            $tagstring = $this->trimmed('tags');
+
+            // Some validation
+            if (!Validate::string($nickname, array('min_length' => 1,
+                            'max_length' => 64,
+                            'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
+                $this->showForm(_('Nickname must have only lowercase letters and numbers and no spaces.'));
+                return;
+            } else if (!User::allowed_nickname($nickname)) {
+                $this->showForm(_('Not a valid nickname.'));
+                return;
+            } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
+                    !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
+                $this->showForm(_('Homepage is not a valid URL.'));
+                return;
+            } else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
+                $this->showForm(_('Full name is too long (max 255 chars).'));
+                return;
+            } else if (!is_null($bio) && mb_strlen($bio) > 140) {
+                $this->showForm(_('Bio is too long (max 140 chars).'));
+                return;
+            } else if (!is_null($location) && mb_strlen($location) > 255) {
+                $this->showForm(_('Location is too long (max 255 chars).'));
+                return;
+            }  else if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) {
+                $this->showForm(_('Timezone not selected.'));
+                return;
+            } else if ($this->nicknameExists($nickname)) {
+                $this->showForm(_('Nickname already in use. Try another one.'));
+                return;
+            } else if (!is_null($language) && strlen($language) > 50) {
+                $this->showForm(_('Language is too long (max 50 chars).'));
+                return;
+            }
 
-        if ($tagstring) {
-            $tags = array_map('common_canonical_tag', preg_split('/[\s,]+/', $tagstring));
-        } else {
-            $tags = array();
-        }
+            if ($tagstring) {
+                $tags = array_map('common_canonical_tag', preg_split('/[\s,]+/', $tagstring));
+            } else {
+                $tags = array();
+            }
 
-        foreach ($tags as $tag) {
-            if (!common_valid_profile_tag($tag)) {
-                $this->showForm(sprintf(_('Invalid tag: "%s"'), $tag));
-                return;
+            foreach ($tags as $tag) {
+                if (!common_valid_profile_tag($tag)) {
+                    $this->showForm(sprintf(_('Invalid tag: "%s"'), $tag));
+                    return;
+                }
             }
-        }
 
-        $user = common_current_user();
+            $user = common_current_user();
 
-        $user->query('BEGIN');
+            $user->query('BEGIN');
 
-        if ($user->nickname != $nickname ||
-            $user->language != $language ||
-            $user->timezone != $timezone) {
+            if ($user->nickname != $nickname ||
+                    $user->language != $language ||
+                    $user->timezone != $timezone) {
 
-            common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname,
-                         __FILE__);
-            common_debug('Updating user language from ' . $user->language . ' to ' . $language,
-                         __FILE__);
-            common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone,
-                         __FILE__);
+                common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname,
+                        __FILE__);
+                common_debug('Updating user language from ' . $user->language . ' to ' . $language,
+                        __FILE__);
+                common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone,
+                        __FILE__);
 
-            $original = clone($user);
+                $original = clone($user);
 
-            $user->nickname = $nickname;
-            $user->language = $language;
-            $user->timezone = $timezone;
+                $user->nickname = $nickname;
+                $user->language = $language;
+                $user->timezone = $timezone;
 
-            $result = $user->updateKeys($original);
+                $result = $user->updateKeys($original);
 
-            if ($result === false) {
-                common_log_db_error($user, 'UPDATE', __FILE__);
-                $this->serverError(_('Couldn\'t update user.'));
-                return;
-            } else {
-                # Re-initialize language environment if it changed
-                common_init_language();
+                if ($result === false) {
+                    common_log_db_error($user, 'UPDATE', __FILE__);
+                    $this->serverError(_('Couldn\'t update user.'));
+                    return;
+                } else {
+                    // Re-initialize language environment if it changed
+                    common_init_language();
+                }
             }
-        }
-
-        # XXX: XOR
 
-        if ($user->autosubscribe ^ $autosubscribe) {
+// XXX: XOR
+            if ($user->autosubscribe ^ $autosubscribe) {
 
-            $original = clone($user);
+                $original = clone($user);
 
-            $user->autosubscribe = $autosubscribe;
+                $user->autosubscribe = $autosubscribe;
 
-            $result = $user->update($original);
+                $result = $user->update($original);
 
-            if ($result === false) {
-                common_log_db_error($user, 'UPDATE', __FILE__);
-                $this->serverError(_('Couldn\'t update user for autosubscribe.'));
-                return;
+                if ($result === false) {
+                    common_log_db_error($user, 'UPDATE', __FILE__);
+                    $this->serverError(_('Couldn\'t update user for autosubscribe.'));
+                    return;
+                }
             }
-        }
-
-        $profile = $user->getProfile();
 
-        $orig_profile = clone($profile);
+            $profile = $user->getProfile();
 
-        $profile->nickname = $user->nickname;
-        $profile->fullname = $fullname;
-        $profile->homepage = $homepage;
-        $profile->bio = $bio;
-        $profile->location = $location;
-        $profile->profileurl = common_profile_url($nickname);
+            $orig_profile = clone($profile);
 
-        common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
-        common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
+            $profile->nickname = $user->nickname;
+            $profile->fullname = $fullname;
+            $profile->homepage = $homepage;
+            $profile->bio = $bio;
+            $profile->location = $location;
+            $profile->profileurl = common_profile_url($nickname);
 
-        $result = $profile->update($orig_profile);
+            common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
+            common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
 
-        if (!$result) {
-            common_log_db_error($profile, 'UPDATE', __FILE__);
-            $this->serverError(_('Couldn\'t save profile.'));
-            return;
-        }
+            $result = $profile->update($orig_profile);
 
-        # Set the user tags
+            if (!$result) {
+                common_log_db_error($profile, 'UPDATE', __FILE__);
+                $this->serverError(_('Couldn\'t save profile.'));
+                return;
+            }
 
-        $result = $user->setSelfTags($tags);
+            // Set the user tags
+            $result = $user->setSelfTags($tags);
 
-        if (!$result) {
-            $this->serverError(_('Couldn\'t save tags.'));
-            return;
-        }
+            if (!$result) {
+                $this->serverError(_('Couldn\'t save tags.'));
+                return;
+            }
 
-        $user->query('COMMIT');
+            $user->query('COMMIT');
+            Event::handle('EndProfileSaveForm', array($this));
+            common_broadcast_profile($profile);
 
-        common_broadcast_profile($profile);
+            $this->showForm(_('Settings saved.'), true);
 
-        $this->showForm(_('Settings saved.'), true);
+        }
     }
 
     function nicknameExists($nickname)
index 5c6fe39d3de3f90cd07375b6b67cf0ac313a1e40..c3cfb8d255d2309e72315c54660a8fbede05338d 100644 (file)
@@ -108,109 +108,109 @@ class RegisterAction extends Action
 
     function tryRegister()
     {
-        $token = $this->trimmed('token');
-        if (!$token || $token != common_session_token()) {
-            $this->showForm(_('There was a problem with your session token. '.
-                              'Try again, please.'));
-            return;
-        }
-
-        $nickname = $this->trimmed('nickname');
-        $email    = $this->trimmed('email');
-        $fullname = $this->trimmed('fullname');
-        $homepage = $this->trimmed('homepage');
-        $bio      = $this->trimmed('bio');
-        $location = $this->trimmed('location');
-
-        // We don't trim these... whitespace is OK in a password!
-
-        $password = $this->arg('password');
-        $confirm  = $this->arg('confirm');
+        if (Event::handle('StartRegistrationTry', array($this))) {
+            $token = $this->trimmed('token');
+            if (!$token || $token != common_session_token()) {
+                $this->showForm(_('There was a problem with your session token. '.
+                            'Try again, please.'));
+                return;
+            }
 
-        // invitation code, if any
+            $nickname = $this->trimmed('nickname');
+            $email    = $this->trimmed('email');
+            $fullname = $this->trimmed('fullname');
+            $homepage = $this->trimmed('homepage');
+            $bio      = $this->trimmed('bio');
+            $location = $this->trimmed('location');
 
-        $code = $this->trimmed('code');
+            // We don't trim these... whitespace is OK in a password!
+            $password = $this->arg('password');
+            $confirm  = $this->arg('confirm');
 
-        $invite = null;
+            // invitation code, if any
+            $code = $this->trimmed('code');
 
-        if ($code) {
-            $invite = Invitation::staticGet($code);
-        }
-
-        if (common_config('site', 'inviteonly') && !($code && !empty($invite))) {
-            $this->clientError(_('Sorry, only invited people can register.'));
-            return;
-        }
+            if ($code) {
+                $invite = Invitation::staticGet($code);
+            }
 
-        // Input scrubbing
-
-        $nickname = common_canonical_nickname($nickname);
-        $email    = common_canonical_email($email);
-
-        if (!$this->boolean('license')) {
-            $this->showForm(_('You can\'t register if you don\'t '.
-                              'agree to the license.'));
-        } else if ($email && !Validate::email($email, true)) {
-            $this->showForm(_('Not a valid email address.'));
-        } else if (!Validate::string($nickname, array('min_length' => 1,
-                                                      'max_length' => 64,
-                                                      'format' => NICKNAME_FMT))) {
-            $this->showForm(_('Nickname must have only lowercase letters '.
-                              'and numbers and no spaces.'));
-        } else if ($this->nicknameExists($nickname)) {
-            $this->showForm(_('Nickname already in use. Try another one.'));
-        } else if (!User::allowed_nickname($nickname)) {
-            $this->showForm(_('Not a valid nickname.'));
-        } else if ($this->emailExists($email)) {
-            $this->showForm(_('Email address already exists.'));
-        } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
-                   !Validate::uri($homepage,
-                                  array('allowed_schemes' =>
-                                        array('http', 'https')))) {
-            $this->showForm(_('Homepage is not a valid URL.'));
-            return;
-        } else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
-            $this->showForm(_('Full name is too long (max 255 chars).'));
-            return;
-        } else if (!is_null($bio) && mb_strlen($bio) > 140) {
-            $this->showForm(_('Bio is too long (max 140 chars).'));
-            return;
-        } else if (!is_null($location) && mb_strlen($location) > 255) {
-            $this->showForm(_('Location is too long (max 255 chars).'));
-            return;
-        } else if (strlen($password) < 6) {
-            $this->showForm(_('Password must be 6 or more characters.'));
-            return;
-        } else if ($password != $confirm) {
-            $this->showForm(_('Passwords don\'t match.'));
-        } else if ($user = User::register(array('nickname' => $nickname,
-                                                'password' => $password,
-                                                'email' => $email,
-                                                'fullname' => $fullname,
-                                                'homepage' => $homepage,
-                                                'bio' => $bio,
-                                                'location' => $location,
-                                                'code' => $code))) {
-            if (!$user) {
-                $this->showForm(_('Invalid username or password.'));
+            if (common_config('site', 'inviteonly') && !($code && $invite)) {
+                $this->clientError(_('Sorry, only invited people can register.'));
                 return;
             }
-            // success!
-            if (!common_set_user($user)) {
-                $this->serverError(_('Error setting user.'));
+
+            // Input scrubbing
+            $nickname = common_canonical_nickname($nickname);
+            $email    = common_canonical_email($email);
+
+            if (!$this->boolean('license')) {
+                $this->showForm(_('You can\'t register if you don\'t '.
+                            'agree to the license.'));
+            } else if ($email && !Validate::email($email, true)) {
+                $this->showForm(_('Not a valid email address.'));
+            } else if (!Validate::string($nickname, array('min_length' => 1,
+                            'max_length' => 64,
+                            'format' => NICKNAME_FMT))) {
+                $this->showForm(_('Nickname must have only lowercase letters '.
+                            'and numbers and no spaces.'));
+            } else if ($this->nicknameExists($nickname)) {
+                $this->showForm(_('Nickname already in use. Try another one.'));
+            } else if (!User::allowed_nickname($nickname)) {
+                $this->showForm(_('Not a valid nickname.'));
+            } else if ($this->emailExists($email)) {
+                $this->showForm(_('Email address already exists.'));
+            } else if (!is_null($homepage) && (strlen($homepage) > 0) &&
+                    !Validate::uri($homepage,
+                        array('allowed_schemes' =>
+                            array('http', 'https')))) {
+                $this->showForm(_('Homepage is not a valid URL.'));
                 return;
+            } else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
+                $this->showForm(_('Full name is too long (max 255 chars).'));
+                return;
+            } else if (!is_null($bio) && mb_strlen($bio) > 140) {
+                $this->showForm(_('Bio is too long (max 140 chars).'));
+                return;
+            } else if (!is_null($location) && mb_strlen($location) > 255) {
+                $this->showForm(_('Location is too long (max 255 chars).'));
+                return;
+            } else if (strlen($password) < 6) {
+                $this->showForm(_('Password must be 6 or more characters.'));
+                return;
+            } else if ($password != $confirm) {
+                $this->showForm(_('Passwords don\'t match.'));
+            } else if ($user = User::register(array('nickname' => $nickname,
+                            'password' => $password,
+                            'email' => $email,
+                            'fullname' => $fullname,
+                            'homepage' => $homepage,
+                            'bio' => $bio,
+                            'location' => $location,
+                            'code' => $code))) {
+                if (!$user) {
+                    $this->showForm(_('Invalid username or password.'));
+                    return;
+                }
+                // success!
+                if (!common_set_user($user)) {
+                    $this->serverError(_('Error setting user.'));
+                    return;
+                }
+                // this is a real login
+                common_real_login(true);
+                if ($this->boolean('rememberme')) {
+                    common_debug('Adding rememberme cookie for ' . $nickname);
+                    common_rememberme($user);
+                }
+
+                Event::handle('EndRegistrationTry', array($this));
+
+                // Re-init language env in case it changed (not yet, but soon)
+                common_init_language();
+                $this->showSuccess();
+            } else {
+                $this->showForm(_('Invalid username or password.'));
             }
-            // this is a real login
-            common_real_login(true);
-            if ($this->boolean('rememberme')) {
-                common_debug('Adding rememberme cookie for ' . $nickname);
-                common_rememberme($user);
-            }
-            // Re-init language env in case it changed (not yet, but soon)
-            common_init_language();
-            $this->showSuccess();
-        } else {
-            $this->showForm(_('Invalid username or password.'));
         }
     }
 
@@ -252,7 +252,9 @@ class RegisterAction extends Action
 
     // overrrided to add entry-title class
     function showPageTitle() {
-        $this->element('h1', array('class' => 'entry-title'), $this->title());
+        if (Event::handle('StartShowPageTitle', array($this))) {
+            $this->element('h1', array('class' => 'entry-title'), $this->title());
+        }
     }
 
     // overrided to add hentry, and content-inner class
@@ -355,9 +357,9 @@ class RegisterAction extends Action
         }
 
         $this->elementStart('form', array('method' => 'post',
-                                          'id' => 'form_register',
-                                          'class' => 'form_settings',
-                                          'action' => common_local_url('register')));
+                    'id' => 'form_register',
+                    'class' => 'form_settings',
+                    'action' => common_local_url('register')));
         $this->elementStart('fieldset');
         $this->element('legend', null, 'Account settings');
         $this->hidden('token', common_session_token());
@@ -367,77 +369,80 @@ class RegisterAction extends Action
         }
 
         $this->elementStart('ul', 'form_data');
-        $this->elementStart('li');
-        $this->input('nickname', _('Nickname'), $this->trimmed('nickname'),
-                     _('1-64 lowercase letters or numbers, '.
-                       'no punctuation or spaces. Required.'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->password('password', _('Password'),
-                        _('6 or more characters. Required.'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->password('confirm', _('Confirm'),
-                        _('Same as password above. Required.'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        if (!empty($invite) && $invite->address_type == 'email') {
-            $this->input('email', _('Email'), $invite->address,
-                         _('Used only for updates, announcements, '.
-                           'and password recovery'));
-        } else {
-            $this->input('email', _('Email'), $this->trimmed('email'),
-                         _('Used only for updates, announcements, '.
-                           'and password recovery'));
-        }
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->input('fullname', _('Full name'),
-                     $this->trimmed('fullname'),
-                     _('Longer name, preferably your "real" name'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->input('homepage', _('Homepage'),
-                     $this->trimmed('homepage'),
-                     _('URL of your homepage, blog, '.
-                       'or profile on another site'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->textarea('bio', _('Bio'),
-                        $this->trimmed('bio'),
-                        _('Describe yourself and your '.
-                          'interests in 140 chars'));
-        $this->elementEnd('li');
-        $this->elementStart('li');
-        $this->input('location', _('Location'),
-                     $this->trimmed('location'),
-                     _('Where you are, like "City, '.
-                       'State (or Region), Country"'));
-        $this->elementEnd('li');
-        $this->elementStart('li', array('id' => 'settings_rememberme'));
-        $this->checkbox('rememberme', _('Remember me'),
-                        $this->boolean('rememberme'),
-                        _('Automatically login in the future; '.
-                          'not for shared computers!'));
-        $this->elementEnd('li');
-        $attrs = array('type' => 'checkbox',
-                       'id' => 'license',
-                       'class' => 'checkbox',
-                       'name' => 'license',
-                       'value' => 'true');
-        if ($this->boolean('license')) {
-            $attrs['checked'] = 'checked';
+        if (Event::handle('StartRegistrationFormData', array($this))) {
+            $this->elementStart('li');
+            $this->input('nickname', _('Nickname'), $this->trimmed('nickname'),
+                    _('1-64 lowercase letters or numbers, '.
+                        'no punctuation or spaces. Required.'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->password('password', _('Password'),
+                    _('6 or more characters. Required.'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->password('confirm', _('Confirm'),
+                    _('Same as password above. Required.'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            if ($invite && $invite->address_type == 'email') {
+                $this->input('email', _('Email'), $invite->address,
+                        _('Used only for updates, announcements, '.
+                            'and password recovery'));
+            } else {
+                $this->input('email', _('Email'), $this->trimmed('email'),
+                        _('Used only for updates, announcements, '.
+                            'and password recovery'));
+            }
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->input('fullname', _('Full name'),
+                    $this->trimmed('fullname'),
+                    _('Longer name, preferably your "real" name'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->input('homepage', _('Homepage'),
+                    $this->trimmed('homepage'),
+                    _('URL of your homepage, blog, '.
+                        'or profile on another site'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->textarea('bio', _('Bio'),
+                    $this->trimmed('bio'),
+                    _('Describe yourself and your '.
+                        'interests in 140 chars'));
+            $this->elementEnd('li');
+            $this->elementStart('li');
+            $this->input('location', _('Location'),
+                    $this->trimmed('location'),
+                    _('Where you are, like "City, '.
+                        'State (or Region), Country"'));
+            $this->elementEnd('li');
+            Event::handle('EndRegistrationFormData', array($this));
+            $this->elementStart('li', array('id' => 'settings_rememberme'));
+            $this->checkbox('rememberme', _('Remember me'),
+                    $this->boolean('rememberme'),
+                    _('Automatically login in the future; '.
+                        'not for shared computers!'));
+            $this->elementEnd('li');
+            $attrs = array('type' => 'checkbox',
+                    'id' => 'license',
+                    'class' => 'checkbox',
+                    'name' => 'license',
+                    'value' => 'true');
+            if ($this->boolean('license')) {
+                $attrs['checked'] = 'checked';
+            }
+            $this->elementStart('li');
+            $this->element('input', $attrs);
+            $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
+            $this->text(_('My text and files are available under '));
+            $this->element('a', array('href' => common_config('license', 'url')),
+                    common_config('license', 'title'), _("Creative Commons Attribution 3.0"));
+            $this->text(_(' except this private data: password, '.
+                        'email address, IM address, and phone number.'));
+            $this->elementEnd('label');
+            $this->elementEnd('li');
         }
-        $this->elementStart('li');
-        $this->element('input', $attrs);
-        $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
-        $this->text(_('My text and files are available under '));
-        $this->element('a', array('href' => common_config('license', 'url')),
-                       common_config('license', 'title'), _("Creative Commons Attribution 3.0"));
-        $this->text(_(' except this private data: password, '.
-                      'email address, IM address, and phone number.'));
-        $this->elementEnd('label');
-        $this->elementEnd('li');
         $this->elementEnd('ul');
         $this->submit('submit', _('Register'));
         $this->elementEnd('fieldset');
@@ -519,3 +524,4 @@ class RegisterAction extends Action
         $nav->show();
     }
 }
+
index 025f8383a276d56ab61dfa51ac830fac177ed06e..a7df397273af91e940b8fa816745add5df24f728 100644 (file)
@@ -35,7 +35,7 @@ if (!defined('LACONICA')) {
 require_once INSTALLDIR.'/lib/noticelist.php';
 require_once INSTALLDIR.'/lib/feedlist.php';
 
-define('MEMBERS_PER_SECTION', 81);
+define('MEMBERS_PER_SECTION', 27);
 
 /**
  * Group main page
@@ -361,7 +361,7 @@ class ShowgroupAction extends Action
              $this->element('p', null, _('(None)'));
         }
 
-        if ($cnt == MEMBERS_PER_SECTION) {
+        if ($cnt > MEMBERS_PER_SECTION) {
             $this->element('a', array('href' => common_local_url('groupmembers',
                                                                  array('nickname' => $this->group->nickname))),
                            _('All members'));
index 81139744ff9cdab7eb928df3f2e83a5df5611562..38d2a9a424febe7a067aba0199131f705d8b13d6 100644 (file)
@@ -166,28 +166,36 @@ $(document).ready(function(){
                                                                                                                                                   $("#notice_action-submit").addClass("disabled");
                                                                                                                                                   return true;
                                                                                                                                                 },
-                                          success: function(xml) {     if ($("#error", xml).length > 0 || $("#command_result", xml).length > 0) {
+                                          success: function(xml) {     if ($("#error", xml).length > 0) {
                                                                                                        var result = document._importNode($("p", xml).get(0), true);
                                                                                                        result = result.textContent || result.innerHTML;
                                                                                                        alert(result);
                                                                                                }
                                                                                                else {
-                                                                                                       $("#notices_primary .notices").prepend(document._importNode($("li", xml).get(0), true));
+                                                                                                   if ($("#command_result", xml).length > 0) {
+                                                                                                           var result = document._importNode($("p", xml).get(0), true);
+                                                                                                           result = result.textContent || result.innerHTML;
+                                                                                                           alert(result);
+                                                    }
+                                                    else {
+                                                                                                           $("#notices_primary .notices").prepend(document._importNode($("li", xml).get(0), true));
+                                                                                                           counter();
+                                                                                                           $("#notices_primary .notice:first").css({display:"none"});
+                                                                                                           $("#notices_primary .notice:first").fadeIn(2500);
+                                                                                                           NoticeHover();
+                                                                                                           NoticeReply();
+                                                                                                       }
                                                                                                        $("#notice_data-text").val("");
-                                                                                                       counter();
-                                                                                                       $("#notices_primary .notice:first").css({display:"none"});
-                                                                                                       $("#notices_primary .notice:first").fadeIn(2500);
-                                                                                                       NoticeHover();
-                                                                                                       NoticeReply();
                                                                                                }
                                                                                                $("#form_notice").removeClass("processing");
                                                                                                $("#notice_action-submit").removeAttr("disabled");
                                                                                                $("#notice_action-submit").removeClass("disabled");
                                                                                         }
                                           };
-       $("#form_notice").ajaxForm(PostNotice);
-       $("#form_notice").each(addAjaxHidden);
-
+    if (document.body.id  != 'inbox' && document.body.id != 'outbox') {
+           $("#form_notice").ajaxForm(PostNotice);
+           $("#form_notice").each(addAjaxHidden);
+    }
     NoticeHover();
     NoticeReply();
 });
index 63e6138df2dee7b182d0a38e40f128e945afe461..acc0336673f5071e4c9fea95f3f51b4cf22dc03f 100644 (file)
@@ -93,43 +93,45 @@ class PersonalGroupNav extends Widget
 
         $this->out->elementStart('ul', array('class' => 'nav'));
 
-        $this->out->menuItem(common_local_url('all', array('nickname' =>
-                                                       $nickname)),
-                         _('Personal'),
-                         sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
-                         $action == 'all', 'nav_timeline_personal');
-        $this->out->menuItem(common_local_url('replies', array('nickname' =>
-                                                              $nickname)),
-                         _('Replies'),
-                         sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
-                         $action == 'replies', 'nav_timeline_replies');
-        $this->out->menuItem(common_local_url('showstream', array('nickname' =>
-                                                              $nickname)),
-                         _('Profile'),
-                         ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
-                         $action == 'showstream', 'nav_profile');
-        $this->out->menuItem(common_local_url('showfavorites', array('nickname' =>
-                                                              $nickname)),
-                         _('Favorites'),
-                         sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
-                         $action == 'showfavorites', 'nav_timeline_favorites');
+        if (Event::handle('StartPersonalGroupNav', array($this))) {
+            $this->out->menuItem(common_local_url('all', array('nickname' =>
+                                                           $nickname)),
+                             _('Personal'),
+                             sprintf(_('%s and friends'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
+                             $action == 'all', 'nav_timeline_personal');
+            $this->out->menuItem(common_local_url('replies', array('nickname' =>
+                                                                  $nickname)),
+                             _('Replies'),
+                             sprintf(_('Replies to %s'), (($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname)),
+                             $action == 'replies', 'nav_timeline_replies');
+            $this->out->menuItem(common_local_url('showstream', array('nickname' =>
+                                                                  $nickname)),
+                             _('Profile'),
+                             ($user_profile && $user_profile->fullname) ? $user_profile->fullname : $nickname,
+                             $action == 'showstream', 'nav_profile');
+            $this->out->menuItem(common_local_url('showfavorites', array('nickname' =>
+                                                                  $nickname)),
+                             _('Favorites'),
+                             sprintf(_('%s\'s favorite notices'), ($user_profile) ? $user_profile->getBestName() : _('User')),
+                             $action == 'showfavorites', 'nav_timeline_favorites');
 
-        $cur = common_current_user();
+            $cur = common_current_user();
 
-        if ($cur && $cur->id == $user->id) {
+            if ($cur && $cur->id == $user->id) {
 
-            $this->out->menuItem(common_local_url('inbox', array('nickname' =>
-                                                                     $nickname)),
-                             _('Inbox'),
-                             _('Your incoming messages'),
-                             $action == 'inbox');
-            $this->out->menuItem(common_local_url('outbox', array('nickname' =>
-                                                                     $nickname)),
-                             _('Outbox'),
-                             _('Your sent messages'),
-                             $action == 'outbox');
+                $this->out->menuItem(common_local_url('inbox', array('nickname' =>
+                                                                         $nickname)),
+                                 _('Inbox'),
+                                 _('Your incoming messages'),
+                                 $action == 'inbox');
+                $this->out->menuItem(common_local_url('outbox', array('nickname' =>
+                                                                         $nickname)),
+                                 _('Outbox'),
+                                 _('Your sent messages'),
+                                 $action == 'outbox');
+            }
+            Event::handle('EndPersonalGroupNav', array($this));
         }
-
         $this->out->elementEnd('ul');
     }
 }
index e74450e11f3e06dee57ce04754d81c7ac02a6bd6..e7ad4affdaab9eaac36e4fae6fe7c586443b9a1e 100644 (file)
@@ -51,7 +51,7 @@ class SearchAction extends Action
      *
      * @return boolean true
      */
-    function isReadOnly($args)
+    function isReadOnly()
     {
         return true;
     }
diff --git a/lib/tagcloudsection.php b/lib/tagcloudsection.php
deleted file mode 100644 (file)
index ff2aca6..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-/**
- * Laconica, the distributed open-source microblogging tool
- *
- * Base class for sections showing tag clouds
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * @category  Widget
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @copyright 2009 Control Yourself, Inc.
- * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
- */
-
-if (!defined('LACONICA')) {
-    exit(1);
-}
-
-define('TAGS_PER_SECTION', 20);
-
-/**
- * Base class for sections
- *
- * These are the widgets that show interesting data about a person
- * group, or site.
- *
- * @category Widget
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://laconi.ca/
- */
-
-class TagCloudSection extends Section
-{
-    function showContent()
-    {
-        $tags = $this->getTags();
-
-        if (!$tags) {
-            $this->out->element('p', null, _('None'));
-            return false;
-        }
-
-        $cnt = 0;
-
-        $tw = array();
-        $sum = 0;
-
-        while ($tags->fetch() && ++$cnt <= TAGS_PER_SECTION) {
-            $tw[$tags->tag] = $tags->weight;
-            $sum += $tags->weight;
-        }
-
-        if ($cnt == 0) {
-            $this->out->element('p', null, _('(None)'));
-            return false;
-        }
-
-        ksort($tw);
-
-        $this->out->elementStart('ul', 'tags xoxo tag-cloud');
-        foreach ($tw as $tag => $weight) {
-            $this->showTag($tag, $weight, ($sum == 0) ? 0 : $weight/$sum);
-        }
-        $this->out->elementEnd('ul');
-
-        return ($cnt > TAGS_PER_SECTION);
-    }
-
-    function getTags()
-    {
-        return null;
-    }
-
-    function showTag($tag, $weight, $relative)
-    {
-        if ($relative > 0.1) {
-            $rel =  'tag-cloud-7';
-        } else if ($relative > 0.05) {
-            $rel = 'tag-cloud-6';
-        } else if ($relative > 0.02) {
-            $rel = 'tag-cloud-5';
-        } else if ($relative > 0.01) {
-            $rel = 'tag-cloud-4';
-        } else if ($relative > 0.005) {
-            $rel = 'tag-cloud-3';
-        } else if ($relative > 0.002) {
-            $rel = 'tag-cloud-2';
-        } else {
-            $rel = 'tag-cloud-1';
-        }
-
-        $this->out->elementStart('li', $rel);
-        $this->out->element('a', array('href' => $this->tagUrl($tag)),
-                       $tag);
-        $this->out->elementEnd('li');
-    }
-
-    function tagUrl($tag)
-    {
-        return common_local_url('tag', array('tag' => $tag));
-    }
-
-    function divId()
-    {
-        return 'tagcloud';
-    }
-}
index b8357c6889545e9a1f5d191b1401637fd0a09e94..6a90b4e2885701d83c99cfe93d08ac0afdf48161 100644 (file)
@@ -418,7 +418,7 @@ class TwitterapiAction extends Action
     function date_twitter($dt)
     {
         $t = strtotime($dt);
-        return date("D M d G:i:s O Y", $t);
+        return date("D M d H:i:s O Y", $t);
     }
 
     // XXX: Candidate for a general utility method somewhere?
index 88876554824d83b74250acfae3ea82c57ffcae27..da009682bbc865e6eaf1431b292b29160f4a49c9 100644 (file)
@@ -1392,3 +1392,4 @@ function common_database_tablename($tablename)
   //table prefixes could be added here later
   return $tablename;
 }
+
index 924fc45453ecc2ef08d5b570962c38d27ab6d839..8b6e974c0aa7af3a87cca507ccfbf10f4d6b1920 100755 (executable)
@@ -54,6 +54,13 @@ class JabberQueueHandler extends XmppQueueHandler
     }
 }
 
+// Abort immediately if xmpp is not enabled, otherwise the daemon chews up
+// lots of CPU trying to connect to unconfigured servers
+if (common_config('xmpp','enabled')==false) {
+    print "Aborting daemon - xmpp is disabled\n";
+    exit();
+}
+
 ini_set("max_execution_time", "0");
 ini_set("max_input_time", "0");
 set_time_limit(0);
@@ -63,4 +70,4 @@ $resource = ($argc > 1) ? $argv[1] : (common_config('xmpp','resource') . '-queue
 
 $handler = new JabberQueueHandler($resource);
 
-$handler->runOnce();
\ No newline at end of file
+$handler->runOnce();
index 5075c12df578aeeec4f45ce8db0bc430902dfe6f..b0fa22d438e6a66c0c3931e33965a739e4afe087 100755 (executable)
@@ -52,6 +52,13 @@ class PublicQueueHandler extends XmppQueueHandler
     }
 }
 
+// Abort immediately if xmpp is not enabled, otherwise the daemon chews up
+// lots of CPU trying to connect to unconfigured servers
+if (common_config('xmpp','enabled')==false) {
+    print "Aborting daemon - xmpp is disabled\n";
+    exit();
+}
+
 ini_set("max_execution_time", "0");
 ini_set("max_input_time", "0");
 set_time_limit(0);
index 2b8b085ce8ec568ba2f1fad4cd000e3816ab2b3c..7f39235fed8464f7e3847990c3976d75e7bd05b8 100755 (executable)
@@ -140,6 +140,13 @@ class XmppConfirmHandler extends XmppQueueHandler
     }
 }
 
+// Abort immediately if xmpp is not enabled, otherwise the daemon chews up
+// lots of CPU trying to connect to unconfigured servers
+if (common_config('xmpp','enabled')==false) {
+    print "Aborting daemon - xmpp is disabled\n";
+    exit();
+}
+
 ini_set("max_execution_time", "0");
 ini_set("max_input_time", "0");
 set_time_limit(0);
index ef3f8c63d862472d52d3af9e725e7c1262797ce9..0ce2f2a28008397867de795afd36d1b0cf943cea 100755 (executable)
@@ -321,6 +321,13 @@ class XMPPDaemon extends Daemon
     }
 }
 
+// Abort immediately if xmpp is not enabled, otherwise the daemon chews up
+// lots of CPU trying to connect to unconfigured servers
+if (common_config('xmpp','enabled')==false) {
+    print "Aborting daemon - xmpp is disabled\n";
+    exit();
+}
+
 ini_set("max_execution_time", "0");
 ini_set("max_input_time", "0");
 set_time_limit(0);