]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
authorEvan Prodromou <evan@status.net>
Wed, 28 Oct 2009 18:21:51 +0000 (14:21 -0400)
committerEvan Prodromou <evan@status.net>
Wed, 28 Oct 2009 18:21:51 +0000 (14:21 -0400)
18 files changed:
.gitignore
actions/emailsettings.php
actions/invite.php
actions/newnotice.php
actions/register.php
classes/User.php
config.php.sample
lib/command.php
lib/commandinterpreter.php
lib/default.php
lib/jabber.php
plugins/Facebook/facebookaction.php
plugins/Facebook/facebookapp.css [new file with mode: 0644]
plugins/Facebook/facebookinvite.php
plugins/OpenID/finishopenidlogin.php
plugins/OpenID/openid.php
theme/base/css/facebookapp.css [deleted file]
theme/default/css/display.css

index 1cde3a6254ad0ce63fd1f8593caa4088184a2c8e..217622c84dcaacd1dc5b08d6d79aea460bbaf548 100644 (file)
@@ -24,4 +24,4 @@ config-*.php
 good-config.php
 lac08.log
 php.log
-
+.DS_Store
index 6eff06c0d667b66fc6056ed706a83a7141efb89a..67b991cdc8b3d09afffe2349c3f9d925d2719898 100644 (file)
@@ -326,7 +326,7 @@ class EmailsettingsAction extends AccountSettingsAction
             $this->showForm(_('Cannot normalize that email address'));
             return;
         }
-        if (!Validate::email($email, true)) {
+        if (!Validate::email($email, common_config('email', 'check_domain'))) {
             $this->showForm(_('Not a valid email address'));
             return;
         } else if ($user->email == $email) {
index 788130c5825e4989a9e7f93fc6baf0270fe184bd..3015202e9e69b39fcc59563bd16f42c34d0a727f 100644 (file)
@@ -68,7 +68,7 @@ class InviteAction extends CurrentUserDesignAction
 
         foreach ($addresses as $email) {
             $email = trim($email);
-            if (!Validate::email($email, true)) {
+            if (!Validate::email($email, common_config('email', 'check_domain'))) {
                 $this->showForm(sprintf(_('Invalid email address: %s'), $email));
                 return;
             }
index 9ee031f93636b0003f5ae6937c4bc9e892f64d48..fe7df0938275819effa189238edcfa6ca6e40627 100644 (file)
@@ -160,18 +160,12 @@ class NewnoticeAction extends Action
 
         if (!$content) {
             $this->clientError(_('No content!'));
-        } else {
-            $content_shortened = common_shorten_links($content);
-            if (Notice::contentTooLong($content_shortened)) {
-                $this->clientError(sprintf(_('That\'s too long. '.
-                                             'Max notice size is %d chars.'),
-                                           Notice::maxContent()));
-            }
+            return;
         }
 
         $inter = new CommandInterpreter();
 
-        $cmd = $inter->handle_command($user, $content_shortened);
+        $cmd = $inter->handle_command($user, $content);
 
         if ($cmd) {
             if ($this->boolean('ajax')) {
@@ -182,6 +176,13 @@ class NewnoticeAction extends Action
             return;
         }
 
+        $content_shortened = common_shorten_links($content);
+        if (Notice::contentTooLong($content_shortened)) {
+            $this->clientError(sprintf(_('That\'s too long. '.
+                                         'Max notice size is %d chars.'),
+                                       Notice::maxContent()));
+        }
+
         $replyto = $this->trimmed('inreplyto');
         #If an ID of 0 is wrongly passed here, it will cause a database error,
         #so override it...
index 100ab74242c74a4244739a3fcc46a56ca937c027..a6c1a903aab33811e019176ae88d011aa79e056d 100644 (file)
@@ -191,7 +191,7 @@ class RegisterAction extends Action
             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)) {
+            } else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) {
                 $this->showForm(_('Not a valid email address.'));
             } else if (!Validate::string($nickname, array('min_length' => 1,
                                                           'max_length' => 64,
index 0a70c9801402f8038d1dc59bb72bf0204ce1f3c7..9481399f8a5d042288888ad40a6efbaa18e5d996 100644 (file)
@@ -319,6 +319,7 @@ class User extends Memcached_DataObject
                                                   common_config('site', 'name'),
                                                   $user->nickname),
                                           'system');
+                common_broadcast_notice($notice);
             }
         }
 
index 997c9d6b0bccb971157c6cc50f5689fc17419f87..9fccb84f3b76f3816130759e74dac69b15d11c7f 100644 (file)
@@ -104,6 +104,10 @@ $config['sphinx']['port'] = 3312;
 // $config['site']['timezone'] = 'Pacific/Auckland';
 // $config['site']['language'] = 'en_NZ';
 
+// When validating user supplied email addresses, validate if the domain
+// is running an SMTP server.
+// $config['mail']['check_domain'] = true;
+
 // Email info, used for all outbound email
 // $config['mail']['notifyfrom'] = 'microblog@example.net';
 // $config['mail']['domain'] = 'microblog.example.net';
index 11d40b8e156da190df5b33aa0a45f8aa36a34041..9efa406964651f8abf3ee1f85e08e93c10420f5b 100644 (file)
@@ -73,7 +73,7 @@ class UntrackCommand extends UnimplementedCommand
     }
 }
 
-class NudgeCommand extends UnimplementedCommand
+class NudgeCommand extends Command
 {
     var $other = null;
     function __construct($user, $other)
@@ -81,6 +81,26 @@ class NudgeCommand extends UnimplementedCommand
         parent::__construct($user);
         $this->other = $other;
     }
+    function execute($channel)
+    {
+        $recipient = User::staticGet('nickname', $this->other);
+        if(! $recipient){
+            $channel->error($this->user, sprintf(_('Could not find a user with nickname %s'),
+                               $this->other));
+        }else{
+            if ($recipient->id == $this->user->id) {
+                $channel->error($this->user, _('It does not make a lot of sense to nudge yourself!'));
+            }else{
+                if ($recipient->email && $recipient->emailnotifynudge) {
+                    mail_notify_nudge($this->user, $recipient);
+                }
+                // XXX: notify by IM
+                // XXX: notify by SMS
+                $channel->output($this->user, sprintf(_('Nudge sent to %s'),
+                               $recipient->nickname));
+            }
+        }
+    }
 }
 
 class InviteCommand extends UnimplementedCommand
@@ -124,18 +144,30 @@ class FavCommand extends Command
 
     function execute($channel)
     {
+        if(substr($this->other,0,1)=='#'){
+            //favoriting a specific notice_id
 
-        $recipient =
-          common_relative_profile($this->user, common_canonical_nickname($this->other));
+            $notice = Notice::staticGet(substr($this->other,1));
+            if (!$notice) {
+                $channel->error($this->user, _('Notice with that id does not exist'));
+                return;
+            }
+            $recipient = $notice->getProfile();
+        }else{
+            //favoriting a given user's last notice
 
-        if (!$recipient) {
-            $channel->error($this->user, _('No such user.'));
-            return;
-        }
-        $notice = $recipient->getCurrentNotice();
-        if (!$notice) {
-            $channel->error($this->user, _('User has no last notice'));
-            return;
+            $recipient =
+              common_relative_profile($this->user, common_canonical_nickname($this->other));
+
+            if (!$recipient) {
+                $channel->error($this->user, _('No such user.'));
+                return;
+            }
+            $notice = $recipient->getCurrentNotice();
+            if (!$notice) {
+                $channel->error($this->user, _('User has no last notice'));
+                return;
+            }
         }
 
         $fave = Fave::addNew($this->user, $notice);
@@ -347,6 +379,71 @@ class MessageCommand extends Command
     }
 }
 
+class ReplyCommand extends Command
+{
+    var $other = null;
+    var $text = null;
+    function __construct($user, $other, $text)
+    {
+        parent::__construct($user);
+        $this->other = $other;
+        $this->text = $text;
+    }
+
+    function execute($channel)
+    {
+        if(substr($this->other,0,1)=='#'){
+            //replying to a specific notice_id
+
+            $notice = Notice::staticGet(substr($this->other,1));
+            if (!$notice) {
+                $channel->error($this->user, _('Notice with that id does not exist'));
+                return;
+            }
+            $recipient = $notice->getProfile();
+        }else{
+            //replying to a given user's last notice
+
+            $recipient =
+              common_relative_profile($this->user, common_canonical_nickname($this->other));
+
+            if (!$recipient) {
+                $channel->error($this->user, _('No such user.'));
+                return;
+            }
+            $notice = $recipient->getCurrentNotice();
+            if (!$notice) {
+                $channel->error($this->user, _('User has no last notice'));
+                return;
+            }
+        }
+
+        $len = mb_strlen($this->text);
+
+        if ($len == 0) {
+            $channel->error($this->user, _('No content!'));
+            return;
+        }
+
+        $this->text = common_shorten_links($this->text);
+
+        if (Notice::contentTooLong($this->text)) {
+            $channel->error($this->user, sprintf(_('Notice too long - maximum is %d characters, you sent %d'),
+                                                 Notice::maxContent(), mb_strlen($this->text)));
+            return;
+        }
+
+        $notice = Notice::saveNew($this->user->id, $this->text, $channel->source(), 1,
+                                  $notice->id);
+        if ($notice) {
+            $channel->output($this->user, sprintf(_('Reply to %s sent'), $recipient->nickname));
+        } else {
+            $channel->error($this->user, _('Error saving notice.'));
+        }
+        common_broadcast_notice($notice);
+    }
+}
+
 class GetCommand extends Command
 {
 
@@ -497,6 +594,9 @@ class HelpCommand extends Command
                            "get <nickname> - get last notice from user\n".
                            "whois <nickname> - get profile info on user\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".
+                           "reply #<notice_id> - reply to notice with a given id\n".
+                           "reply <nickname> - reply to the last notice from user\n".
                            "join <group> - join group\n".
                            "drop <group> - leave group\n".
                            "stats - get your stats\n".
@@ -507,7 +607,7 @@ class HelpCommand extends Command
                            "last <nickname> - same as 'get'\n".
                            "on <nickname> - not yet implemented.\n".
                            "off <nickname> - not yet implemented.\n".
-                           "nudge <nickname> - not yet implemented.\n".
+                           "nudge <nickname> - remind a user to update.\n".
                            "invite <phone number> - not yet implemented.\n".
                            "track <word> - not yet implemented.\n".
                            "untrack <word> - not yet implemented.\n".
index 60fc4c3c44802755af6e8bc1c6a5e4ea54bd92f1..b921a17cc25cedec84860fbd19cdd83f50defe1b 100644 (file)
@@ -134,6 +134,17 @@ class CommandInterpreter
             } else {
                 return new MessageCommand($user, $other, $extra);
             }
+         case 'r':
+         case 'reply':
+            if (!$arg) {
+                return null;
+            }
+            list($other, $extra) = $this->split_arg($arg);
+            if (!$extra) {
+                return null;
+            } else {
+                return new ReplyCommand($user, $other, $extra);
+            }
          case 'whois':
             if (!$arg) {
                 return null;
index 30e43eefbd65394762bd0a5d4d447603b75997a3..9f64cc9e48b2d870e0b501600dd8d20dcc2deacd 100644 (file)
@@ -84,7 +84,8 @@ $default =
               'image' => 'http://i.creativecommons.org/l/by/3.0/80x15.png'),
         'mail' =>
         array('backend' => 'mail',
-              'params' => null),
+              'params' => null,
+              'domain_check' => true),
         'nickname' =>
         array('blacklist' => array(),
               'featured' => array()),
index 3dcdce5dbf349b87b629e9186bcb98ef519d22a9..73f2ec66059a6010fa956a80cdfe528500d27817 100644 (file)
@@ -176,6 +176,7 @@ function jabber_format_entry($profile, $notice)
     $xs = new XMLStringer();
     $xs->elementStart('html', array('xmlns' => 'http://jabber.org/protocol/xhtml-im'));
     $xs->elementStart('body', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
+    $xs->element("img", array('src'=> $profile->avatarUrl(AVATAR_MINI_SIZE) , 'alt' => $profile->nickname));
     $xs->element('a', array('href' => $profile->profileurl),
                  $profile->nickname);
     $xs->text(": ");
@@ -184,6 +185,11 @@ function jabber_format_entry($profile, $notice)
     } else {
         $xs->raw(common_render_content($notice->content, $notice));
     }
+    $xs->raw(" ");
+    $xs->element('a', array(
+        'href'=>common_local_url('conversation',
+            array('id' => $notice->conversation)).'#notice-'.$notice->id
+         ),sprintf(_('notice id: %s'),$notice->id));
     $xs->elementEnd('body');
     $xs->elementEnd('html');
 
index f5ad3d06b4be00efc25c41571ca8138fb5384237..a10fdf90d4e55b5214be9a982d9eef80aa0dbdca 100644 (file)
@@ -83,8 +83,8 @@ class FacebookAction extends Action
     function showStylesheets()
     {
         $this->cssLink('css/display.css', 'base');
-        $this->cssLink('css/display.css',null,'screen, projection, tv');
-        $this->cssLink('css/facebookapp.css', 'base');
+        $this->cssLink('css/display.css', null, 'screen, projection, tv');
+        $this->cssLink('plugins/Facebook/facebookapp.css');
     }
 
     function showScripts()
diff --git a/plugins/Facebook/facebookapp.css b/plugins/Facebook/facebookapp.css
new file mode 100644 (file)
index 0000000..8cd06f7
--- /dev/null
@@ -0,0 +1,115 @@
+* {
+font-size:14px;
+font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
+}
+
+#wrap {
+background-color:#F0F2F5;
+padding-left:1.795%;
+padding-right:1.795%;
+width:auto;
+}
+
+p,label,
+h1,h2,h3,h4,h5,h6 {
+color:#000;
+}
+
+#header {
+width:131%;
+}
+
+#content {
+width:92.7%;
+}
+
+#aside_primary {
+display:none;
+}
+
+#site_nav_local_views a {
+background-color:#D0DFE7;
+}
+#site_nav_local_views a:hover {
+background-color:#FAFBFC;
+}
+
+#form_notice .form_note + label,
+#form_notice #notice_data-attach {
+display:none;
+}
+
+#form_notice #notice_action-submit {
+height:47px !important;
+}
+
+
+span.facebook-button {
+border: 2px solid #aaa;
+padding: 3px;
+display: block;
+float: left;
+margin-right: 20px;
+-moz-border-radius: 4px; 
+border-radius:4px; 
+-webkit-border-radius:4px;
+font-weight: bold;
+background-color:#A9BF4F;
+color:#fff;
+font-size:1.2em
+}
+
+span.facebook-button a { color:#fff }
+
+.facebook_guide {
+margin-bottom:18px;
+}
+.facebook_guide p {
+font-weight:bold;
+}
+
+
+input {
+height:auto !important;
+}
+
+#facebook-friends {
+float:left;
+width:100%;
+}
+
+#facebook-friends li {
+float:left;
+margin-right:2%;
+margin-bottom:11px;
+width:18%;
+height:115px;
+}
+#facebook-friends li a {
+float:left;
+}
+
+#add_to_profile {
+position:absolute;
+right:18px;
+top:10px;
+z-index:2;
+}
+
+.notice div.entry-content dl,
+.notice div.entry-content dt, 
+.notice div.entry-content dd {
+margin-right:5px;
+}
+
+#content_inner p {
+margin-bottom:18px;
+}
+
+#content_inner ul {
+list-style-type:none;
+}
+
+.form_settings label {
+margin-right:18px;
+}
index ecda1717c3e37b2b184a12ce8460e6ab2005fd1c..3380b4c857d4de1f365d5534cf80fbc76ae5c71e 100644 (file)
@@ -105,6 +105,7 @@ class FacebookinviteAction extends FacebookAction
         $multi_params = array('showborder' => 'false');
         $multi_params['actiontext'] = $actiontext;
         $multi_params['bypass'] = 'cancel';
+        $multi_params['cols'] = 4;
 
         // Get a list of users who are already using the app for exclusion
         $exclude_ids = $this->facebook->api_client->friends_getAppUsers();
index 50a9c15c87a8730e2b9fb7ce11f415e97cb93d32..ff0b451d30e28e4e1b367e666df9894750d99b4a 100644 (file)
@@ -265,7 +265,7 @@ class FinishopenidloginAction extends Action
             $fullname = '';
         }
 
-        if (!empty($sreg['email']) && Validate::email($sreg['email'], true)) {
+        if (!empty($sreg['email']) && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
             $email = $sreg['email'];
         } else {
             $email = '';
index 0944117c00fc5e0b2a62401184ac7ea2ac3db822..b76497c28aaedcd9dc0229ad2ff7193fdca2cf1d 100644 (file)
@@ -241,7 +241,7 @@ function oid_update_user(&$user, &$sreg)
 
     $orig_user = clone($user);
 
-    if ($sreg['email'] && Validate::email($sreg['email'], true)) {
+    if ($sreg['email'] && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
         $user->email = $sreg['email'];
     }
 
diff --git a/theme/base/css/facebookapp.css b/theme/base/css/facebookapp.css
deleted file mode 100644 (file)
index e6b1c9e..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-* {
-font-size:14px;
-font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
-}
-
-#wrap {
-background-color:#F0F2F5;
-padding-left:18px;
-padding-right:18px;
-width:auto;
-}
-
-p,label,
-h1,h2,h3,h4,h5,h6 {
-color:#000;
-}
-
-#content {
-width:95%;
-}
-
-#site_nav_local_views a {
-background-color:#D0DFE7;
-}
-#site_nav_local_views a:hover {
-background-color:#FAFBFC;
-}
-
-span.facebook-button {
-border: 2px solid #aaa;
-padding: 3px;
-display: block;
-float: left;
-margin-right: 20px;
--moz-border-radius: 4px; 
-border-radius:4px; 
--webkit-border-radius:4px;
-font-weight: bold;
-background-color:#A9BF4F;
-color:#fff;
-font-size:1.2em
-}
-
-span.facebook-button a { color:#fff }
-
-.facebook_guide {
-margin-bottom:18px;
-}
-.facebook_guide p {
-font-weight:bold;
-}
-
-
-input {
-height:auto !important;
-}
-
-#facebook-friends {
-float:left;
-width:100%;
-}
-
-#facebook-friends li {
-float:left;
-margin-right:2%;
-margin-bottom:11px;
-width:18%;
-height:115px;
-}
-#facebook-friends li a {
-float:left;
-}
-
-#add_to_profile {
-position:absolute;
-right:18px;
-top:10px;
-z-index:2;
-}
-
-.notice div.entry-content dl,
-.notice div.entry-content dt, 
-.notice div.entry-content dd {
-margin-right:5px;
-}
-
-#content_inner p {
-margin-bottom:18px;
-}
-
-#content_inner ul {
-list-style-type:none;
-}
-
-.form_settings label {
-margin-right:18px;
-}
index 6833373b456a2920542406078562b95d88ee61a0..a5f1fd6e47e47179dbc7636097536b9e0a34131f 100644 (file)
@@ -18,7 +18,7 @@ font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
 font-size:1em;
 }
 address {
-margin-right:5.8%;
+margin-right:5.7%;
 }
 
 input, textarea, select, option {