]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.9.x' into 1.0.x
authorBrion Vibber <brion@pobox.com>
Mon, 18 Oct 2010 19:17:11 +0000 (12:17 -0700)
committerBrion Vibber <brion@pobox.com>
Mon, 18 Oct 2010 19:17:11 +0000 (12:17 -0700)
Conflicts:
README
lib/default.php

1  2 
README
actions/shownotice.php
actions/showstream.php
lib/default.php
lib/util.php

diff --combined README
index 0ee83a9ee8f13eb84f248e3025f511fbfffcc55e,35c510e2b8d4b972c11c24d03e49187f24a6606b..d69ec8fdd024e3f0652046d002abbcf088105c04
--- 1/README
--- 2/README
+++ b/README
@@@ -683,8 -683,9 +683,9 @@@ instructions; read to the end first bef
  6. Move your StatusNet directory to a backup spot, like "statusnet.bak".
  7. Unpack your StatusNet 0.9.5 tarball and move it to "statusnet" or
     wherever your code used to be.
- 8. Copy the config.php file and avatar directory from your old
-    directory to your new directory.
+ 8. Copy the config.php file and the contents of the avatar/, background/,
+    file/, and local/ subdirectories from your old directory to your new
+    directory.
  9. Copy htaccess.sample to .htaccess in the new directory. Change the
     RewriteBase to use the correct path.
  10. Rebuild the database. (You can safely skip this step and go to #12
@@@ -864,7 -865,9 +865,7 @@@ sslserver: use an alternate server nam
      parameters correctly so that both the SSL server and the
      "normal" server can access the session cookie and
      preferably other cookies as well.
 -shorturllength: Length of URL at which URLs in a message exceeding 140
 -    characters will be sent to the user's chosen
 -    shortening service.
 +shorturllength: ignored. See 'url' section below.
  dupelimit: minimum time allowed for one person to say the same thing
      twice. Default 60s. Anything lower is considered a user
      or UI error.
@@@ -1499,22 -1502,33 +1500,49 @@@ disallow: Array of (virtual) directorie
      'search', 'message', 'settings', 'admin'. Ignored when site
      is private, in which case the entire site ('/') is disallowed.
  
+ api
+ ---
+ Options for the Twitter-like API.
+ realm: HTTP Basic Auth realm (see http://tools.ietf.org/html/rfc2617
+     for details). Some third-party tools like ping.fm want this to be
+     'Identi.ca API', so set it to that if you want to. default = null,
+     meaning 'something based on the site name'.
+ nofollow
+ --------
+ We optionally put 'rel="nofollow"' on some links in some pages. The
+ following configuration settings let you fine-tune how or when things
+ are nofollowed. See http://en.wikipedia.org/wiki/Nofollow for more
+ information on what 'nofollow' means.
+ subscribers: whether to nofollow links to subscribers on the profile
+     and personal pages. Default is true.
+ members: links to members on the group page. Default true.
+ peopletag: links to people listed in the peopletag page. Default true.
+ external: external links in notices. One of three values: 'sometimes',
+     'always', 'never'. If 'sometimes', then external links are not
+     nofollowed on profile, notice, and favorites page. Default is
+     'sometimes'.
 +url
 +---
 +
 +Everybody loves URL shorteners. These are some options for fine-tuning
 +how and when the server shortens URLs.
 +
 +shortener: URL shortening service to use by default. Users can override
 +           individually. 'ur1.ca' by default.
 +maxlength: If an URL is strictly longer than this limit, it will be
 +           shortened. Note that the URL shortener service may return an
 +           URL longer than this limit. Defaults to 25. Users can
 +           override. If set to 0, all URLs will be shortened.
 +maxnoticelength: If a notice is strictly longer than this limit, all
 +           URLs in the notice will be shortened. Users can override.
 +           -1 means the text limit for notices.
 +
  Plugins
  =======
  
diff --combined actions/shownotice.php
index 93d056acac7e36cd4d4760a4dfc6620860a7184e,5fc863486c13620fec91072fa1f7f9e3b9bd662b..5b3ec93de10b64082bceb30bc5de46a4c3693c2d
@@@ -278,6 -278,12 +278,6 @@@ class ShownoticeAction extends OwnerDes
                                           'content' => $id->toString()));
          }
  
 -        if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
 -            $id = new Microid('xmpp:', $user->jabber,
 -                              $this->notice->uri);
 -            $this->element('meta', array('name' => 'microid',
 -                                         'content' => $id->toString()));
 -        }
          $this->element('link',array('rel'=>'alternate',
              'type'=>'application/json+oembed',
              'href'=>common_local_url(
      }
  }
  
- class SingleNoticeItem extends NoticeListItem
+ class SingleNoticeItem extends DoFollowListItem
  {
      /**
       * recipe function for displaying a single notice.
diff --combined actions/showstream.php
index b2082eb4b599d923c6af842822adae35f8e5efca,be61a7ce0d759b22655ec0ca2fcdca03d89de5d7..8178dafb17d4d7c0fce80e372a1cff9ee1801247
@@@ -165,6 -165,12 +165,6 @@@ class ShowstreamAction extends ProfileA
                                $this->selfUrl());
              $this->element('meta', array('name' => 'microid',
                                           'content' => $id->toString()));
 -        }
 -        if ($this->user->jabbermicroid && $this->user->jabber && $this->profile->profileurl) {
 -            $id = new Microid('xmpp:'.$this->user->jabber,
 -                              $this->selfUrl());
 -            $this->element('meta', array('name' => 'microid',
 -                                         'content' => $id->toString()));
          }
  
          // See https://wiki.mozilla.org/Microsummaries
@@@ -269,7 -275,7 +269,7 @@@ class ProfileNoticeList extends NoticeL
      }
  }
  
- class ProfileNoticeListItem extends NoticeListItem
+ class ProfileNoticeListItem extends DoFollowListItem
  {
      function showAuthor()
      {
diff --combined lib/default.php
index 279a7a3d11f0106949052c90298bfaeb8eb74291,a19453fce49ddb3ec2edcd61f78e42f9220b395f..a1dac7b5e1110590d5d01b9c9deb5ba5954b5e0b
@@@ -300,13 -300,11 +300,13 @@@ $default 
                                   'OStatus' => null,
                                   'WikiHashtags' => null,
                                   'RSSCloud' => null,
 +                                 'ClientSideShorten' => null,
                                   'OpenID' => null),
                'locale_path' => false, // Set to a path to use *instead of* each plugin's own locale subdirectories
                ),
 +        'pluginlist' => array(),
          'admin' =>
 -        array('panels' => array('design', 'site', 'user', 'paths', 'access', 'sessions', 'sitenotice', 'license')),
 +        array('panels' => array('design', 'site', 'user', 'paths', 'access', 'sessions', 'sitenotice', 'license', 'plugins')),
          'singleuser' =>
          array('enabled' => false,
                'nickname' => null),
          'nofollow' =>
          array('subscribers' => true,
                'members' => true,
-               'peopletag' => true),
+               'peopletag' => true,
+               'external' => 'sometimes'), // Options: 'sometimes', 'never', default = 'sometimes'
 +        'url' =>
 +        array('shortener' => 'ur1.ca',
 +              'maxlength' => 25,
 +              'maxnoticelength' => -1),
          'http' => // HTTP client settings when contacting other sites
          array('ssl_cafile' => false, // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt')
                'curl' => false, // Use CURL backend for HTTP fetches if available. (If not, PHP's socket streams will be used.)
diff --combined lib/util.php
index 85d7c72f453fb59b58ecd671bb975409b17b081d,5a94182bda6d8fd48214636d34cae7845bf3835f..1d7cffe419012035341835a54c8164678d77a773
@@@ -157,38 -157,22 +157,38 @@@ function common_timezone(
      return common_config('site', 'timezone');
  }
  
 +function common_valid_language($lang)
 +{
 +    if ($lang) {
 +        // Validate -- we don't want to end up with a bogus code
 +        // left over from some old junk.
 +        foreach (common_config('site', 'languages') as $code => $info) {
 +            if ($info['lang'] == $lang) {
 +                return true;
 +            }
 +        }
 +    }
 +    return false;
 +}
 +
  function common_language()
  {
 +    // Allow ?uselang=xx override, very useful for debugging
 +    // and helping translators check usage and context.
 +    if (isset($_GET['uselang'])) {
 +        $uselang = strval($_GET['uselang']);
 +        if (common_valid_language($uselang)) {
 +            return $uselang;
 +        }
 +    }
 +
      // If there is a user logged in and they've set a language preference
      // then return that one...
      if (_have_config() && common_logged_in()) {
          $user = common_current_user();
 -        $user_language = $user->language;
 -
 -        if ($user->language) {
 -            // Validate -- we don't want to end up with a bogus code
 -            // left over from some old junk.
 -            foreach (common_config('site', 'languages') as $code => $info) {
 -                if ($info['lang'] == $user_language) {
 -                    return $user_language;
 -                }
 -            }
 +
 +        if (common_valid_language($user->language)) {
 +            return $user->language;
          }
      }
  
@@@ -875,7 -859,8 +875,8 @@@ function common_linkify($url) 
              $longurl = $url;
          }
      }
-     $attrs = array('href' => $canon, 'title' => $longurl, 'rel' => 'external');
+     $attrs = array('href' => $canon, 'title' => $longurl);
  
      $is_attachment = false;
      $attachment_id = null;
          $attrs['id'] = "attachment-{$attachment_id}";
      }
  
+     // Whether to nofollow
+     $nf = common_config('nofollow', 'external');
+     if ($nf == 'never') {
+         $attrs['rel'] = 'external';
+     } else {
+         $attrs['rel'] = 'nofollow external';
+     }
      return XMLStringer::estring('a', $attrs, $url);
  }
  
  function common_shorten_links($text, $always = false)
  {
 -    $maxLength = Notice::maxContent();
 -    if (!$always && ($maxLength == 0 || mb_strlen($text) <= $maxLength)) return $text;
 -    return common_replace_urls_callback($text, array('File_redirection', 'makeShort'));
 +    common_debug("common_shorten_links() called");
 +
 +    $user = common_current_user();
 +
 +    $maxLength = User_urlshortener_prefs::maxNoticeLength($user);
 +
 +    common_debug("maxLength = $maxLength");
 +
 +    if ($always || mb_strlen($text) > $maxLength) {
 +        common_debug("Forcing shortening");
 +        return common_replace_urls_callback($text, array('File_redirection', 'forceShort'));
 +    } else {
 +        common_debug("Not forcing shortening");
 +        return common_replace_urls_callback($text, array('File_redirection', 'makeShort'));
 +    }
  }
  
  /**
@@@ -1303,8 -1286,14 +1314,8 @@@ function common_redirect($url, $code=30
      exit;
  }
  
 -function common_broadcast_notice($notice, $remote=false)
 -{
 -    // DO NOTHING!
 -}
 +// Stick the notice on the queue
  
 -/**
 - * Stick the notice on the queue.
 - */
  function common_enqueue_notice($notice)
  {
      static $localTransports = array('omb',
          $transports[] = 'plugin';
      }
  
 -    $xmpp = common_config('xmpp', 'enabled');
 -
 -    if ($xmpp) {
 -        $transports[] = 'jabber';
 -    }
 -
      // We can skip these for gatewayed notices.
      if ($notice->isLocal()) {
          $transports = array_merge($transports, $localTransports);
 -        if ($xmpp) {
 -            $transports[] = 'public';
 -        }
      }
  
      if (Event::handle('StartEnqueueNotice', array($notice, &$transports))) {
@@@ -1858,6 -1856,21 +1869,6 @@@ function common_session_token(
      return $_SESSION['token'];
  }
  
 -function common_cache_key($extra)
 -{
 -    return Cache::key($extra);
 -}
 -
 -function common_keyize($str)
 -{
 -    return Cache::keyize($str);
 -}
 -
 -function common_memcache()
 -{
 -    return Cache::instance();
 -}
 -
  function common_license_terms($uri)
  {
      if(preg_match('/creativecommons.org\/licenses\/([^\/]+)/', $uri, $matches)) {
@@@ -1898,42 -1911,30 +1909,42 @@@ function common_database_tablename($tab
  /**
   * Shorten a URL with the current user's configured shortening service,
   * or ur1.ca if configured, or not at all if no shortening is set up.
 - * Length is not considered.
   *
 - * @param string $long_url
 + * @param string  $long_url original URL
 + * @param boolean $force    Force shortening (used when notice is too long)
 + *
   * @return string may return the original URL if shortening failed
   *
   * @fixme provide a way to specify a particular shortener
   * @fixme provide a way to specify to use a given user's shortening preferences
   */
 -function common_shorten_url($long_url)
 +
 +function common_shorten_url($long_url, $force = false)
  {
 +    common_debug("Shortening URL '$long_url' (force = $force)");
 +
      $long_url = trim($long_url);
 +
      $user = common_current_user();
 -    if (empty($user)) {
 -        // common current user does not find a user when called from the XMPP daemon
 -        // therefore we'll set one here fix, so that XMPP given URLs may be shortened
 -        $shortenerName = 'ur1.ca';
 -    } else {
 -        $shortenerName = $user->urlshorteningservice;
 +
 +    $maxUrlLength = User_urlshortener_prefs::maxUrlLength($user);
 +    common_debug("maxUrlLength = $maxUrlLength");
 +
 +    // $force forces shortening even if it's not strictly needed
 +
 +    if (mb_strlen($long_url) < $maxUrlLength && !$force) {
 +        common_debug("Skipped shortening URL.");
 +        return $long_url;
      }
  
 -    if(Event::handle('StartShortenUrl', array($long_url,$shortenerName,&$shortenedUrl))){
 +    $shortenerName = User_urlshortener_prefs::urlShorteningService($user);
 +
 +    common_debug("Shortener name = '$shortenerName'");
 +
 +    if (Event::handle('StartShortenUrl', array($long_url, $shortenerName, &$shortenedUrl))) {
          //URL wasn't shortened, so return the long url
          return $long_url;
 -    }else{
 +    } else {
          //URL was shortened, so return the result
          return trim($shortenedUrl);
      }