]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.8.x' of git@gitorious.org:~brion/statusnet/brion-fixes into 0.8.x
authorBrion Vibber <brion@pobox.com>
Tue, 13 Oct 2009 16:45:26 +0000 (16:45 +0000)
committerBrion Vibber <brion@pobox.com>
Tue, 13 Oct 2009 16:45:26 +0000 (16:45 +0000)
22 files changed:
actions/api.php
actions/editgroup.php
actions/groupsearch.php
actions/twitapistatuses.php
classes/Profile.php
classes/Session.php
classes/User.php
lib/clienterroraction.php
lib/common.php
lib/error.php
lib/htmloutputter.php
lib/searchaction.php
lib/servererroraction.php
lib/twitterapi.php
lib/util.php
plugins/FBConnect/FBCLoginGroupNav.php
plugins/FBConnect/FBCSettingsNav.php
plugins/FBConnect/FBConnectPlugin.php
plugins/Realtime/RealtimePlugin.php
plugins/Realtime/realtimeupdate.js
scripts/deleteuser.php [new file with mode: 0644]
theme/base/css/display.css

index c236378bcb4f2a0fcd454c74a223580785fb8641..3705d035c4a22c1813a8ddb6f7f852ce12ccc6c0 100644 (file)
@@ -142,6 +142,7 @@ class ApiAction extends Action
 
         static $bareauth = array('statuses/user_timeline',
                                  'statuses/friends_timeline',
+                                'statuses/home_timeline',
                                  'statuses/friends',
                                  'statuses/replies',
                                  'statuses/mentions',
index e7ba836a0153dfe79531c46fcb926d2655c6dc3a..b8dac31cb180421a565e62c2e9d10e5cbdadaba7 100644 (file)
@@ -250,7 +250,6 @@ class EditgroupAction extends GroupDesignAction
         $this->group->homepage    = $homepage;
         $this->group->description = $description;
         $this->group->location    = $location;
-        $this->group->created     = common_sql_now();
 
         $result = $this->group->update($orig);
 
index be15efc47cea5c0be163b3095db9264b53328840..517f127895ca49f6a25c97f8f87e6d7e70ef115c 100644 (file)
@@ -106,7 +106,7 @@ class GroupSearchResults extends GroupList
 
     function __construct($user_group, $terms, $action)
     {
-        parent::__construct($user_group, $terms, $action);
+        parent::__construct($user_group, null, $action);
         $this->terms = array_map('preg_quote',
                                  array_map('htmlspecialchars', $terms));
         $this->pattern = '/('.implode('|',$terms).')/i';
index 5e2867ea8137160896c0272cdc8f1f0e4371085f..360dff27cbda9da08365911340d46d80eb76e875 100644 (file)
@@ -297,7 +297,7 @@ class TwitapistatusesAction extends TwitterapiAction
                     $source, 1, $reply_to);
 
             if (is_string($notice)) {
-                $this->serverError($notice);
+                $this->serverError($notice, 500, $apidata['content-type']);
                 return;
             }
 
@@ -454,7 +454,7 @@ class TwitapistatusesAction extends TwitterapiAction
     function friends($args, $apidata)
     {
         parent::handle($args);
-        $includeStatuses=! (boolean) $args['lite'];
+        $includeStatuses= !(array_key_exists('lite', $args) and $args['lite']);
         return $this->subscriptions($apidata, 'subscribed', 'subscriber', false, $includeStatuses);
     }
 
@@ -467,7 +467,7 @@ class TwitapistatusesAction extends TwitterapiAction
     function followers($args, $apidata)
     {
         parent::handle($args);
-        $includeStatuses=! (boolean) $args['lite'];
+        $includeStatuses= !(array_key_exists('lite', $args) and $args['lite']);
         return $this->subscriptions($apidata, 'subscriber', 'subscribed', false, $includeStatuses);
     }
 
index 6ad0e7a3a3b3f3884fbe221466cb034938550551..8385ebf8890bb5e6f7a229b0d059dfedfbed2168 100644 (file)
@@ -461,4 +461,79 @@ class Profile extends Memcached_DataObject
             $c->delete(common_cache_key('profile:notice_count:'.$this->id));
         }
     }
+
+    function delete()
+    {
+        $this->_deleteNotices();
+        $this->_deleteSubscriptions();
+        $this->_deleteMessages();
+        $this->_deleteTags();
+        $this->_deleteBlocks();
+
+        $related = array('Avatar',
+                         'Reply',
+                         'Group_member',
+                         );
+
+        foreach ($related as $cls) {
+            $inst = new $cls();
+            $inst->profile_id = $this->id;
+            $inst->delete();
+        }
+
+        parent::delete();
+    }
+
+    function _deleteNotices()
+    {
+        $notice = new Notice();
+        $notice->profile_id = $this->id;
+
+        if ($notice->find()) {
+            while ($notice->fetch()) {
+                $other = clone($notice);
+                $other->delete();
+            }
+        }
+    }
+
+    function _deleteSubscriptions()
+    {
+        $sub = new Subscription();
+        $sub->subscriber = $this->id;
+        $sub->delete();
+
+        $subd = new Subscription();
+        $subd->subscribed = $this->id;
+        $subd->delete();
+    }
+
+    function _deleteMessages()
+    {
+        $msg = new Message();
+        $msg->from_profile = $this->id;
+        $msg->delete();
+
+        $msg = new Message();
+        $msg->to_profile = $this->id;
+        $msg->delete();
+    }
+
+    function _deleteTags()
+    {
+        $tag = new Profile_tag();
+        $tag->tagged = $this->id;
+        $tag->delete();
+    }
+
+    function _deleteBlocks()
+    {
+        $block = new Profile_block();
+        $block->blocked = $this->id;
+        $block->delete();
+
+        $block = new Group_block();
+        $block->blocked = $this->id;
+        $block->delete();
+    }
 }
index d641edbbe408af12c87bdcd32a416672429d2eeb..79a69a96ea3dc11b1f93672890f1687f2e263fa0 100644 (file)
@@ -85,9 +85,18 @@ class Session extends Memcached_DataObject
 
             return $session->insert();
         } else {
-            $session->session_data = $session_data;
+            if (strcmp($session->session_data, $session_data) == 0) {
+                self::logdeb("Not writing session '$id'; unchanged");
+                return true;
+            } else {
+                self::logdeb("Session '$id' data changed; updating");
+
+                $orig = clone($session);
+
+                $session->session_data = $session_data;
 
-            return $session->update();
+                return $session->update($orig);
+            }
         }
     }
 
index 8386f1e185bb7e41bbf4191e4a504bb195b9b848..007662131c70a0a44702f1caa114e38f680d1ba5 100644 (file)
@@ -689,4 +689,48 @@ class User extends Memcached_DataObject
     {
         return Design::staticGet('id', $this->design_id);
     }
+
+    function delete()
+    {
+        $profile = $this->getProfile();
+        $profile->delete();
+
+        $related = array('Fave',
+                         'User_openid',
+                         'Confirm_address',
+                         'Remember_me',
+                         'Foreign_link',
+                         'Invitation',
+                         );
+
+        if (common_config('inboxes', 'enabled')) {
+            $related[] = 'Notice_inbox';
+        }
+
+        foreach ($related as $cls) {
+            $inst = new $cls();
+            $inst->user_id = $this->id;
+            $inst->delete();
+        }
+
+        $this->_deleteTags();
+        $this->_deleteBlocks();
+
+        parent::delete();
+    }
+
+    function _deleteTags()
+    {
+        $tag = new Profile_tag();
+        $tag->tagger = $this->id;
+        $tag->delete();
+    }
+
+    function _deleteBlocks()
+    {
+        $block = new Profile_block();
+        $block->blocker = $this->id;
+        $block->delete();
+        // XXX delete group block? Reset blocker?
+    }
 }
index 7d007a75675775ee35fa67dc89ea79acb2774426..1b98a1064570d6472bfc2c553925be5d15efb3a8 100644 (file)
@@ -46,28 +46,28 @@ require_once INSTALLDIR.'/lib/error.php';
  */
 class ClientErrorAction extends ErrorAction
 {
+    static $status = array(400 => 'Bad Request',
+                           401 => 'Unauthorized',
+                           402 => 'Payment Required',
+                           403 => 'Forbidden',
+                           404 => 'Not Found',
+                           405 => 'Method Not Allowed',
+                           406 => 'Not Acceptable',
+                           407 => 'Proxy Authentication Required',
+                           408 => 'Request Timeout',
+                           409 => 'Conflict',
+                           410 => 'Gone',
+                           411 => 'Length Required',
+                           412 => 'Precondition Failed',
+                           413 => 'Request Entity Too Large',
+                           414 => 'Request-URI Too Long',
+                           415 => 'Unsupported Media Type',
+                           416 => 'Requested Range Not Satisfiable',
+                           417 => 'Expectation Failed');
+
     function __construct($message='Error', $code=400)
     {
         parent::__construct($message, $code);
-
-        $this->status  = array(400 => 'Bad Request',
-                               401 => 'Unauthorized',
-                               402 => 'Payment Required',
-                               403 => 'Forbidden',
-                               404 => 'Not Found',
-                               405 => 'Method Not Allowed',
-                               406 => 'Not Acceptable',
-                               407 => 'Proxy Authentication Required',
-                               408 => 'Request Timeout',
-                               409 => 'Conflict',
-                               410 => 'Gone',
-                               411 => 'Length Required',
-                               412 => 'Precondition Failed',
-                               413 => 'Request Entity Too Large',
-                               414 => 'Request-URI Too Long',
-                               415 => 'Unsupported Media Type',
-                               416 => 'Requested Range Not Satisfiable',
-                               417 => 'Expectation Failed');
         $this->default = 400;
     }
 
@@ -91,9 +91,4 @@ class ClientErrorAction extends ErrorAction
 
         $this->showPage();
     }
-
-    function title()
-    {
-        return $this->status[$this->code];
-    }
 }
index 88d77732f4cda50508fe33e94585048baf56454c..0b4e031845b287723eeeceb0ae3b72a5f855b2fc 100644 (file)
@@ -196,15 +196,14 @@ $config =
         array('enabled' => true),
         'sms' =>
         array('enabled' => true),
-        'twitter' =>
-        array('enabled' => true),
         'twitterbridge' =>
         array('enabled' => false),
         'integration' =>
         array('source' => 'StatusNet', # source attribute for Twitter
               'taguri' => $_server.',2009'), # base for tag URIs
        'twitter' =>
-       array('consumer_key'    => null,
+       array('enabled'         => true,
+              'consumer_key'    => null,
              'consumer_secret' => null),
         'memcached' =>
         array('enabled' => false,
index 0c521db08124a29d77259ae3dfb25df5dadb0f49..6a9b76be11b97391f41ac13292ed76f38bdeba2a 100644 (file)
@@ -44,9 +44,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  */
 class ErrorAction extends Action
 {
+    static $status = array();
+
     var $code    = null;
     var $message = null;
-    var $status  = null;
     var $default = null;
 
     function __construct($message, $code, $output='php://output', $indent=true)
@@ -88,9 +89,10 @@ class ErrorAction extends Action
      *
      * @return page title
      */
+
     function title()
     {
-        return $this->message;
+        return self::$status[$this->code];
     }
 
     function isReadOnly($args)
index aa01f6b1d9d268e5855864efe428027cf4aa5916..2ff9380cc15bc16183e738e084b8ab6628a31cb1 100644 (file)
@@ -106,14 +106,16 @@ class HTMLOutputter extends XMLOutputter
             }
         }
 
-        header('Content-Type: '.$type);
+        header('Content-Type: '.$type.'; charset=UTF-8');
 
         $this->extraHeaders();
-        if( ! substr($type,0,strlen('text/html'))=='text/html' ){
-            // Browsers don't like it when <?xml it output for non-xhtml documents
+        if (preg_match("/.*\/.*xml/", $type)) {
+            // Required for XML documents
             $this->xw->startDocument('1.0', 'UTF-8');
         }
-        $this->xw->writeDTD('html');
+        $this->xw->writeDTD('html',
+                            '-//W3C//DTD XHTML 1.0 Strict//EN',
+                            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
 
         $language = $this->getLanguage();
 
@@ -425,16 +427,12 @@ class HTMLOutputter extends XMLOutputter
     function autofocus($id)
     {
         $this->elementStart('script', array('type' => 'text/javascript'));
-        $this->raw('
-        <!--
-        $(document).ready(function() {
-            var el = $("#' . $id . '");
-            if (el.length) {
-                el.focus();
-            }
-        });
-        -->
-        ');
+        $this->raw('/*<![CDATA[*/'.
+                   ' $(document).ready(function() {'.
+                   ' var el = $("#' . $id . '");'.
+                   ' if (el.length) { el.focus(); }'.
+                   ' });'.
+                   ' /*]]>*/');
         $this->elementEnd('script');
     }
 }
index 0d9f85a8f18a5f623628bfec448b68002ce9390e..130b28ff52d7f5e57cce80ac0fd5ca45ff5ddfdb 100644 (file)
@@ -135,16 +135,21 @@ class SearchAction extends Action
     }
 
     function searchSuggestions($q) {
-        $qe = urlencode($q);
-        $message = sprintf(_(<<<E_O_T
+        $message = _(<<<E_O_T
 * Make sure all words are spelled correctly.
 * Try different keywords.
 * Try more general keywords.
 * Try fewer keywords.
 
+E_O_T
+);
+        if (!common_config('site', 'private')) {
+            $qe = urlencode($q);
+            $message .= sprintf(_(<<<E_O_T
+
 You can also try your search on other engines:
 
-* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=identi.ca)
+* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=%%%%site.server%%%%)
 * [Tweet scan](http://www.tweetscan.com/indexi.php?s=%s)
 * [Google](http://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
 * [Yahoo](http://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
@@ -152,6 +157,7 @@ You can also try your search on other engines:
 
 E_O_T
 ), $qe, $qe, $qe, $qe, $qe);
+        }
         $this->elementStart('dl', array('id' => 'help_search', 'class' => 'help'));
         $this->element('dt', null, _('Search help'));
         $this->elementStart('dd', 'instructions');
index c6400605ea9bdc1936829b8e2d92e19c3350159c..0993a63bca506149dcecddf892b6d264d4b1cd8e 100644 (file)
@@ -55,17 +55,17 @@ require_once INSTALLDIR.'/lib/error.php';
 
 class ServerErrorAction extends ErrorAction
 {
+    static $status = array(500 => 'Internal Server Error',
+                           501 => 'Not Implemented',
+                           502 => 'Bad Gateway',
+                           503 => 'Service Unavailable',
+                           504 => 'Gateway Timeout',
+                           505 => 'HTTP Version Not Supported');
+
     function __construct($message='Error', $code=500)
     {
         parent::__construct($message, $code);
 
-        $this->status  = array(500 => 'Internal Server Error',
-                               501 => 'Not Implemented',
-                               502 => 'Bad Gateway',
-                               503 => 'Service Unavailable',
-                               504 => 'Gateway Timeout',
-                               505 => 'HTTP Version Not Supported');
-
         $this->default = 500;
 
         // Server errors must be logged.
@@ -93,9 +93,4 @@ class ServerErrorAction extends ErrorAction
 
         $this->showPage();
     }
-
-    function title()
-    {
-        return $this->status[$this->code];
-    }
 }
index 638efba2415b56ac006247cffc37f942f9f0b59b..3bac400e2f678a1ad95001816f769f1dfeca846d 100644 (file)
@@ -501,7 +501,7 @@ class TwitterapiAction extends Action
             $enclosure = $entry['enclosures'][0];
             $this->element('enclosure', array('url'=>$enclosure['url'],'type'=>$enclosure['mimetype'],'length'=>$enclosure['size']), null);
         }
-        
+
         if(array_key_exists('tags', $entry)){
             foreach($entry['tags'] as $tag){
                 $this->element('category', null,$tag);
@@ -939,35 +939,16 @@ class TwitterapiAction extends Action
 
     function clientError($msg, $code = 400, $content_type = 'json')
     {
-
-        static $status = array(400 => 'Bad Request',
-                               401 => 'Unauthorized',
-                               402 => 'Payment Required',
-                               403 => 'Forbidden',
-                               404 => 'Not Found',
-                               405 => 'Method Not Allowed',
-                               406 => 'Not Acceptable',
-                               407 => 'Proxy Authentication Required',
-                               408 => 'Request Timeout',
-                               409 => 'Conflict',
-                               410 => 'Gone',
-                               411 => 'Length Required',
-                               412 => 'Precondition Failed',
-                               413 => 'Request Entity Too Large',
-                               414 => 'Request-URI Too Long',
-                               415 => 'Unsupported Media Type',
-                               416 => 'Requested Range Not Satisfiable',
-                               417 => 'Expectation Failed');
-
         $action = $this->trimmed('action');
 
         common_debug("User error '$code' on '$action': $msg", __FILE__);
 
-        if (!array_key_exists($code, $status)) {
+        if (!array_key_exists($code, ClientErrorAction::$status)) {
             $code = 400;
         }
 
-        $status_string = $status[$code];
+        $status_string = ClientErrorAction::$status[$code];
+
         header('HTTP/1.1 '.$code.' '.$status_string);
 
         if ($content_type == 'xml') {
@@ -986,6 +967,35 @@ class TwitterapiAction extends Action
 
     }
 
+    function serverError($msg, $code = 500, $content_type = 'json')
+    {
+        $action = $this->trimmed('action');
+
+        common_debug("Server error '$code' on '$action': $msg", __FILE__);
+
+        if (!array_key_exists($code, ServerErrorAction::$status)) {
+            $code = 400;
+        }
+
+        $status_string = ServerErrorAction::$status[$code];
+
+        header('HTTP/1.1 '.$code.' '.$status_string);
+
+        if ($content_type == 'xml') {
+            $this->init_document('xml');
+            $this->elementStart('hash');
+            $this->element('error', null, $msg);
+            $this->element('request', null, $_SERVER['REQUEST_URI']);
+            $this->elementEnd('hash');
+            $this->end_document('xml');
+        } else {
+            $this->init_document('json');
+            $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
+            print(json_encode($error_array));
+            $this->end_document('json');
+        }
+    }
+
     function init_twitter_rss()
     {
         $this->startXML();
index b831859e993392d14de493f3ae349d9e61e919e2..9b299cb14fccebe93ece134836c09362f041ce29 100644 (file)
@@ -981,7 +981,7 @@ function common_set_returnto($url)
 function common_get_returnto()
 {
     common_ensure_session();
-    return $_SESSION['returnto'];
+    return (array_key_exists('returnto', $_SESSION)) ? $_SESSION['returnto'] : null;
 }
 
 function common_timestamp()
@@ -1148,7 +1148,7 @@ function common_negotiate_type($cprefs, $sprefs)
     }
 
     if ('text/html' === $besttype) {
-        return "text/html; charset=utf-8";
+        return "text/html";
     }
     return $besttype;
 }
index 6e12c20403cc0a9e5a52038d0b2e131672134102..81b2520a4c628e2830b66657878f82252cd8fe4c 100644 (file)
@@ -78,16 +78,20 @@ class FBCLoginGroupNav extends Widget
         // action => array('prompt', 'title')
         $menu = array();
 
-        $menu['login'] = array(_('Login'),
-                         _('Login with a username and password'));
-
-        if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
-            $menu['register'] = array(_('Register'),
-                                _('Sign up for a new account'));
+        if (!common_config('site','openidonly')) {
+            $menu['login'] = array(_('Login'),
+                             _('Login with a username and password'));
+
+            if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
+                $menu['register'] = array(_('Register'),
+                                    _('Sign up for a new account'));
+            }
         }
 
-        $menu['openidlogin'] = array(_('OpenID'),
-                               _('Login or register with OpenID'));
+        if (common_config('openid', 'enabled')) {
+            $menu['openidlogin'] = array(_('OpenID'),
+                                   _('Login or register with OpenID'));
+        }
 
         $menu['FBConnectLogin'] = array(_('Facebook'),
                                _('Login or register using Facebook'));
index 29724d6bdfa6e2227ec28b9fe468d493e148c658..ed02371e2531a12e5ea80602390451f7b3f17a5b 100644 (file)
@@ -77,32 +77,34 @@ class FBCSettingsNav extends Widget
         $this->action->elementStart('dd');
 
         # action => array('prompt', 'title')
-        $menu =
-          array('imsettings' =>
-                array(_('IM'),
-                      _('Updates by instant messenger (IM)')),
-                'smssettings' =>
-                array(_('SMS'),
-                      _('Updates by SMS')),
-                'twittersettings' =>
-                array(_('Twitter'),
-                      _('Twitter integration options')),
-                'FBConnectSettings' =>
-                array(_('Facebook'),
-                      _('Facebook Connect settings')));
+        $menu = array();
+        if (common_config('xmpp', 'enabled')) {
+            $menu['imsettings'] =
+              array(_('IM'),
+                    _('Updates by instant messenger (IM)'));
+        }
+        if (common_config('sms', 'enabled')) {
+            $menu['smssettings'] =
+              array(_('SMS'),
+                    _('Updates by SMS'));
+        }
+        if (common_config('twitter', 'enabled')) {
+            $menu['twittersettings'] =
+              array(_('Twitter'),
+                    _('Twitter integration options'));
+        }
+        $menu['FBConnectSettings'] =
+          array(_('Facebook'),
+                _('Facebook Connect settings'));
 
         $action_name = $this->action->trimmed('action');
         $this->action->elementStart('ul', array('class' => 'nav'));
 
         foreach ($menu as $menuaction => $menudesc) {
-            if ($menuaction == 'imsettings' &&
-                !common_config('xmpp', 'enabled')) {
-                continue;
-            }
             $this->action->menuItem(common_local_url($menuaction),
-                                   $menudesc[0],
-                                   $menudesc[1],
-                                   $action_name === $menuaction);
+                                    $menudesc[0],
+                                    $menudesc[1],
+                                    $action_name === $menuaction);
         }
 
         $this->action->elementEnd('ul');
index 593b49b4ed4810ec391387d0e78ffa909c60cbc6..ff74aade45b9301b1934afc45392dd207fc4151a 100644 (file)
@@ -232,6 +232,14 @@ class FBConnectPlugin extends Plugin
     {
 
         $user = common_current_user();
+        $connect = 'FBConnectSettings';
+        if (common_config('xmpp', 'enabled')) {
+            $connect = 'imsettings';
+        } else if (common_config('sms', 'enabled')) {
+            $connect = 'smssettings';
+        } else if (common_config('twitter', 'enabled')) {
+            $connect = 'twittersettings';
+        }
 
         if (!empty($user)) {
 
@@ -266,13 +274,8 @@ class FBConnectPlugin extends Plugin
                 _('Home'), _('Personal profile and friends timeline'), false, 'nav_home');
             $action->menuItem(common_local_url('profilesettings'),
                 _('Account'), _('Change your email, avatar, password, profile'), false, 'nav_account');
-            if (common_config('xmpp', 'enabled')) {
-                $action->menuItem(common_local_url('imsettings'),
-                    _('Connect'), _('Connect to IM, SMS, Twitter'), false, 'nav_connect');
-            } else {
-             $action->menuItem(common_local_url('smssettings'),
-                 _('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect');
-            }
+            $action->menuItem(common_local_url($connect),
+                _('Connect'), _('Connect to services'), false, 'nav_connect');
             if (common_config('invite', 'enabled')) {
                 $action->menuItem(common_local_url('invite'),
                     _('Invite'),
@@ -300,18 +303,30 @@ class FBConnectPlugin extends Plugin
              }
          }
          else {
-             if (!common_config('site', 'closed')) {
-                 $action->menuItem(common_local_url('register'),
-                     _('Register'), _('Create an account'), false, 'nav_register');
+             if (!common_config('site', 'openidonly')) {
+                 if (!common_config('site', 'closed')) {
+                     $action->menuItem(common_local_url('register'),
+                         _('Register'), _('Create an account'), false, 'nav_register');
+                 }
+                 $action->menuItem(common_local_url('login'),
+                     _('Login'), _('Login to the site'), false, 'nav_login');
+             } else {
+                 $this->menuItem(common_local_url('openidlogin'),
+                                 _('OpenID'), _('Login with OpenID'), false, 'nav_openid');
              }
-             $action->menuItem(common_local_url('login'),
-                 _('Login'), _('Login to the site'), false, 'nav_login');
          }
 
          $action->menuItem(common_local_url('doc', array('title' => 'help')),
              _('Help'), _('Help me!'), false, 'nav_help');
-         $action->menuItem(common_local_url('peoplesearch'),
-             _('Search'), _('Search for people or text'), false, 'nav_search');
+         if ($user || !common_config('site', 'private')) {
+             $action->menuItem(common_local_url('peoplesearch'),
+                 _('Search'), _('Search for people or text'), false, 'nav_search');
+         }
+
+        // We are replacing the primary nav entirely; give other
+        // plugins a chance to handle it here.
+
+        Event::handle('EndPrimaryNav', array($action));
 
         return false;
     }
index e30c4115676b3740205af9caec39936a7b1c03eb..0f0d0f9f42309b134298220d3fc1d148e3ae2ed7 100644 (file)
@@ -216,8 +216,6 @@ class RealtimePlugin extends Plugin
                                                               'class' => 'user_in')
                               : array('id' => $action->trimmed('action')));
 
-        $action->elementStart('div', array('id' => 'header'));
-
         // XXX hack to deal with JS that tries to get the
         // root url from page output
 
@@ -230,7 +228,6 @@ class RealtimePlugin extends Plugin
         if (common_logged_in()) {
             $action->showNoticeForm();
         }
-        $action->elementEnd('div');
 
         $action->showContentBlock();
         $action->elementEnd('body');
index a31565177fe3f1b04646de996f92904fd0dcbc9b..4cd68a816b2bde0fc2d2a9cbeb424accd747a4fd 100644 (file)
@@ -14,6 +14,18 @@ RealtimeUpdate = {
         RealtimeUpdate._replyurl = replyurl;
         RealtimeUpdate._favorurl = favorurl;
         RealtimeUpdate._deleteurl = deleteurl;
+
+        $(window).blur(function() {
+          $('#notices_primary .notice').css({
+            'border-top-color':$('#notices_primary .notice:last').css('border-top-color'),
+            'border-top-style':'dotted'
+          });
+
+          $('#notices_primary .notice:first').css({
+            'border-top-color':'#AAAAAA',
+            'border-top-style':'solid'
+          });
+        });
      },
 
      receive: function(data)
@@ -27,7 +39,7 @@ RealtimeUpdate = {
           }
 
           var noticeItem = RealtimeUpdate.makeNoticeItem(data);
-          $("#notices_primary .notices").prepend(noticeItem, true);
+          $("#notices_primary .notices").prepend(noticeItem);
           $("#notices_primary .notice:first").css({display:"none"});
           $("#notices_primary .notice:first").fadeIn(1000);
           NoticeReply();
@@ -113,8 +125,8 @@ RealtimeUpdate = {
 
      addPopup: function(url, timeline, iconurl)
      {
-         $('#content').prepend('<button id="realtime_timeline" title="Realtime window">Realtime</button>');
+         $('#content').prepend('<button id="realtime_timeline" title="Pop up in a window">Pop up</button>');
+
          $('#realtime_timeline').css({
              'margin':'0 0 18px 0',
              'background':'transparent url('+ iconurl + ') no-repeat 0% 30%',
@@ -127,21 +139,38 @@ RealtimeUpdate = {
              'font-weight':'bold',
              'font-size':'1em'
          });
+
          $('#realtime_timeline').click(function() {
              window.open(url,
                          timeline,
                          'toolbar=no,resizable=yes,scrollbars=yes,status=yes');
+
              return false;
          });
      },
 
      initPopupWindow: function()
      {
-         window.resizeTo(575, 640);
+         window.resizeTo(500, 550);
          $('address').hide();
-         $('#content').css({'width':'92%'});
+         $('#content').css({'width':'93.5%'});
+
+         $('#form_notice').css({
+            'margin':'18px 0 18px 1.795%',
+            'width':'93%',
+            'max-width':'451px'
+         });
+
+         $('#form_notice label[for=notice_data-text], h1').css({'display': 'none'});
+
+         $('.notices li:first-child').css({'border-top-color':'transparent'});
+
+         $('#form_notice label[for="notice_data-attach"], #form_notice #notice_data-attach').css({'top':'0'});
+
+         $('#form_notice #notice_data-attach').css({
+            'left':'auto',
+            'right':'0'
+         });
      }
 }
 
diff --git a/scripts/deleteuser.php b/scripts/deleteuser.php
new file mode 100644 (file)
index 0000000..5238912
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/env php
+<?php
+/*
+ * StatusNet - a distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
+ *
+ * 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/>.
+ */
+
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+
+$shortoptions = 'i::n::y';
+$longoptions = array('id::nickname::yes');
+
+$helptext = <<<END_OF_DELETEUSER_HELP
+deleteuser.php [options]
+deletes a user from the database
+
+  -i --id       ID of the user
+  -n --nickname nickname of the user
+  -y --yes      do not wait for confirmation
+
+END_OF_DELETEUSER_HELP;
+
+require_once INSTALLDIR.'/scripts/commandline.inc';
+
+if (have_option('i', 'id')) {
+    $id = get_option_value('i', 'id');
+    $user = User::staticGet('id', $id);
+    if (empty($user)) {
+        print "Can't find user with ID $id\n";
+        exit(1);
+    }
+} else if (have_option('n', 'nickname')) {
+    $nickname = get_option_value('n', 'nickname');
+    $user = User::staticGet('nickname', $nickname);
+    if (empty($user)) {
+        print "Can't find user with nickname '$nickname'\n";
+        exit(1);
+    }
+} else {
+    print "You must provide either an ID or a nickname.\n";
+    exit(1);
+}
+
+if (!have_option('y', 'yes')) {
+    print "About to PERMANENTLY delete user '{$user->nickname}' ({$user->id}). Are you sure? [y/N] ";
+    $response = fgets(STDIN);
+    if (strtolower(trim($response)) != 'y') {
+        print "Aborting.\n";
+        exit(0);
+    }
+}
+
+print "Deleting...";
+$user->delete();
+print "DONE.\n";
index 1f37a7637bc8e69ab5fc3ce4a0caad5ab119a0c1..7706fba4845b58ab59daeec51e070eb58d296d7f 100644 (file)
@@ -484,7 +484,7 @@ height:16px;
 #form_notice .form_note {
 position:absolute;
 bottom:2px;
-right:98px;
+right:21.715%;
 z-index:9;
 }
 #form_notice .form_note dt {