]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge remote branch 'statusnet/0.9.x' into 1.0.x
authorCraig Andrews <candrews@integralblue.com>
Thu, 14 Oct 2010 19:27:17 +0000 (15:27 -0400)
committerCraig Andrews <candrews@integralblue.com>
Thu, 14 Oct 2010 19:27:17 +0000 (15:27 -0400)
1  2 
EVENTS.txt
README
lib/apiaction.php
lib/connectsettingsaction.php
lib/default.php
lib/htmloutputter.php
lib/statusnet.php

diff --combined EVENTS.txt
index 58189b9c3f2681e9927a1512328d4ece0ae6abb4,e5cafa857378400d380a45d1e83605f2e47c31fe..ee6f795855ac3659d04ccae3d49d6b48bd496fad
@@@ -569,12 -569,6 +569,12 @@@ EndPublicXRDS: End XRDS output (right b
  - $action: the current action
  - &$xrdsoutputter - XRDSOutputter object to write to
  
 +StartHostMetaLinks: Start /.well-known/host-meta links
 +- &links: array containing the links elements to be written
 +
 +EndHostMetaLinks: End /.well-known/host-meta links
 +- &links: array containing the links elements to be written
 +
  StartCheckPassword: Check a username/password
  - $nickname: The nickname to check
  - $password: The password to check
@@@ -740,24 -734,6 +740,24 @@@ StartShowContentLicense: Showing the de
  EndShowContentLicense: Showing the default license for content
  - $action: the current action
  
 +GetImTransports: Get IM transports that are available
 +- &$transports: append your transport to this array like so: $transports[transportName]=array('display'=>display)
 +
 +NormalizeImScreenname: Normalize an IM screenname
 +- $transport: transport the screenname is on
 +- &$screenname: screenname to be normalized
 +
 +ValidateImScreenname: Validate an IM screenname
 +- $transport: transport the screenname is on
 +- $screenname: screenname to be validated
 +- $valid: is the screenname valid?
 +
 +SendImConfirmationCode: Send a confirmation code to confirm a user owns an IM screenname
 +- $transport: transport the screenname exists on
 +- $screenname: screenname being confirmed
 +- $code: confirmation code for confirmation URL
 +- $user: user requesting the confirmation
 +
  StartUserRegister: When a new user is being registered
  - &$profile: new profile data (no ID)
  - &$user: new user account (no ID or URI)
@@@ -1160,3 -1136,9 +1160,9 @@@ StartShowFeedLink: before showing an in
  EndShowFeedLink: after showing an individual feed
  - $action: action being executed
  - $feed: feed to show
+ StartShowNoticeForm: before showing the notice form (before <form>)
+ - $action: action being executed
+ EndShowNoticeForm: after showing the notice form (after <form>)
+ - $action: action being executed
diff --combined README
index 934fb94fc9659cd956197d53082a7aad059eb7d4,6b351f143dbb4630aa69b3dc3170840f251ce793..0ee83a9ee8f13eb84f248e3025f511fbfffcc55e
--- 1/README
--- 2/README
+++ b/README
@@@ -852,6 -852,8 +852,8 @@@ notice: A plain string that will appea
      be escaped.
  logo: URL of an image file to use as the logo for the site. Overrides
      the logo in the theme, if any.
+ ssllogo: URL of an image file to use as the logo on SSL pages. If unset,
+     theme logo is used instead.
  ssl: Whether to use SSL and https:// URLs for some or all pages.
      Possible values are 'always' (use it for all pages), 'never'
      (don't use it for any pages), or 'sometimes' (use it for
@@@ -862,7 -864,9 +864,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.
@@@ -1109,6 -1113,9 +1111,9 @@@ path: Path part of theme URLs, before t
      which means to use the site path + '/theme'.
  ssl: Whether to use SSL for theme elements. Default is null, which means
      guess based on site SSL settings.
+ sslserver: SSL server to use when page is HTTPS-encrypted. If
+     unspecified, site ssl server and so on will be used.
+ sslpath: If sslserver if defined, path to use when page is HTTPS-encrypted.
  
  javascript
  ----------
@@@ -1120,6 -1127,9 +1125,9 @@@ path: Path part of Javascript URLs. Def
      which means to use the site path + '/js/'.
  ssl: Whether to use SSL for JavaScript files. Default is null, which means
      guess based on site SSL settings.
+ sslserver: SSL server to use when page is HTTPS-encrypted. If
+     unspecified, site ssl server and so on will be used.
+ sslpath: If sslserver if defined, path to use when page is HTTPS-encrypted.
  
  xmpp
  ----
@@@ -1347,6 -1357,11 +1355,11 @@@ ssl: whether to use HTTPS for file URLs
  filecommand: command to use for determining the type of a file. May be
      skipped if fileinfo extension is installed. Defaults to
      '/usr/bin/file'.
+ sslserver: if specified, this server will be used when creating HTTPS
+     URLs. Otherwise, the site SSL server will be used, with /file/ path.
+ sslpath: if this and the sslserver are specified, this path will be used
+     when creating HTTPS URLs. Otherwise, the attachments|path value
+     will be used.
  
  group
  -----
@@@ -1403,8 -1418,9 +1416,9 @@@ dir: directory to write backgrounds too
      subdir of install dir.
  path: path to backgrounds. Default is sub-path of install path; note
      that you may need to change this if you change site-path too.
- ssl: Whether or not to use HTTPS for background files. Defaults to
-     null, meaning to guess from site-wide SSL settings.
+ sslserver: SSL server to use when page is HTTPS-encrypted. If
+     unspecified, site ssl server and so on will be used.
+ sslpath: If sslserver if defined, path to use when page is HTTPS-encrypted.
  
  ping
  ----
@@@ -1485,22 -1501,6 +1499,22 @@@ disallow: Array of (virtual) directorie
      'search', 'message', 'settings', 'admin'. Ignored when site
      is private, in which case the entire site ('/') is disallowed.
  
 +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 lib/apiaction.php
index d8249055a492d30c980e4aad3ed7106b6d2c79db,afba8ab634b9f0009e5ea0ef7c7fdfb73f56ea7a..fbc3a1451f5df1dfc8902cd3f2327a89a6b9be2f
@@@ -98,8 -98,6 +98,8 @@@ if (!defined('STATUSNET')) 
      exit(1);
  }
  
 +class ApiValidationException extends Exception { }
 +
  /**
   * Contains most of the Twitter-compatible API output functions.
   *
@@@ -1246,23 -1244,29 +1246,29 @@@ class ApiAction extends Actio
  
          // Do not emit error header for JSONP
          if (!isset($this->callback)) {
-             header('HTTP/1.1 '.$code.' '.$status_string);
+             header('HTTP/1.1 ' . $code . ' ' . $status_string);
          }
  
-         if ($format == 'xml') {
+         switch($format) {
+         case 'xml':
              $this->initDocument('xml');
              $this->elementStart('hash');
              $this->element('error', null, $msg);
              $this->element('request', null, $_SERVER['REQUEST_URI']);
              $this->elementEnd('hash');
              $this->endDocument('xml');
-         } elseif ($format == 'json'){
+             break;
+         case 'json':
              $this->initDocument('json');
              $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);
              print(json_encode($error_array));
              $this->endDocument('json');
-         } else {
+             break;
+         case 'text':
+             header('Content-Type: text/plain; charset=utf-8');
+             print $msg;
+             break;
+         default:
              // If user didn't request a useful format, throw a regular client error
              throw new ClientException($msg, $code);
          }
index c2e759f0f38e7cd92b11305c3814a716861f6a21,325276c5fcd2a1c9643bd9c0df95821f4aa32289..0f64fee8ce8e04c6561b5672e73317c2e9d2cab1
@@@ -100,9 -100,7 +100,9 @@@ class ConnectSettingsNav extends Widge
  
              # action => array('prompt', 'title')
              $menu = array();
 -            if (common_config('xmpp', 'enabled')) {
 +            $transports = array();
 +            Event::handle('GetImTransports', array(&$transports));
 +            if ($transports) {
                  $menu['imsettings'] =
                    // TRANS: Menu item for Instant Messaging settings.
                    array(_m('MENU','IM'),
              }
  
              $menu['oauthconnectionssettings'] = array(
-                 // TRANS: Menu item for OAth connection settings.
+                 // TRANS: Menu item for OuAth connection settings.
                  _m('MENU','Connections'),
-                 // TRANS: Tooltip for connected applications (Connections through OAth) menu item.
+                 // TRANS: Tooltip for connected applications (Connections through OAuth) menu item.
                  _('Authorized connected applications')
              );
  
diff --combined lib/default.php
index 79b54fc3bddb8e216a2efd8a62d2de847fc2d1c5,fb032930b2d391618a3e3b387fa8e469adaa6ce5..279a7a3d11f0106949052c90298bfaeb8eb74291
@@@ -37,6 -37,7 +37,7 @@@ $default 
                'path' => $_path,
                'logfile' => null,
                'logo' => null,
+               'ssllogo' => null,
                'logdebug' => false,
                'fancy' => false,
                'locale_path' => INSTALLDIR.'/locale',
          array('server' => null,
                'dir' => INSTALLDIR . '/file/',
                'path' => $_path . '/file/',
+               'sslserver' => null,
+               'sslpath' => null,
                'ssl' => null,
                'supported' => array('image/png',
                                     'image/jpeg',
                                   '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),
          array('subscribers' => true,
                'members' => true,
                'peopletag' => true),
 +        '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/htmloutputter.php
index 9780dc42432b87b4d04e3ced4643660e313b9652,42bff44908b797cb78bdf78315a28ebdfd315de1..d079fac06947228811bbe2133264bd20ec1567cd
@@@ -177,7 -177,7 +177,7 @@@ class HTMLOutputter extends XMLOutputte
          $attrs = array('name' => $id,
                         'type' => 'text',
                         'id' => $id);
 -        if ($value) {
 +        if (!is_null($value)) { // value can be 0 or ''
              $attrs['value'] = $value;
          }
          $this->element('input', $attrs);
       */
      function script($src, $type='text/javascript')
      {
-         if(Event::handle('StartScriptElement', array($this,&$src,&$type))) {
+         if (Event::handle('StartScriptElement', array($this,&$src,&$type))) {
  
              $url = parse_url($src);
  
-             if( empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment']))
-             {
+             if (empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment'])) {
+                 // XXX: this seems like a big assumption
                  if (strpos($src, 'plugins/') === 0 || strpos($src, 'local/') === 0) {
  
-                     $src = common_path($src) . '?version=' . STATUSNET_VERSION;
+                     $src = common_path($src, StatusNet::isHTTPS()) . '?version=' . STATUSNET_VERSION;
  
-                 }else{
+                 } else {
  
-                     $path = common_config('javascript', 'path');
+                     if (StatusNet::isHTTPS()) {
  
-                     if (empty($path)) {
-                         $path = common_config('site', 'path') . '/js/';
-                     }
+                         $sslserver = common_config('javascript', 'sslserver');
  
-                     if ($path[strlen($path)-1] != '/') {
-                         $path .= '/';
-                     }
+                         if (empty($sslserver)) {
+                             if (is_string(common_config('site', 'sslserver')) &&
+                                 mb_strlen(common_config('site', 'sslserver')) > 0) {
+                                 $server = common_config('site', 'sslserver');
+                             } else if (common_config('site', 'server')) {
+                                 $server = common_config('site', 'server');
+                             }
+                             $path   = common_config('site', 'path') . '/js/';
+                         } else {
+                             $server = $sslserver;
+                             $path   = common_config('javascript', 'sslpath');
+                             if (empty($path)) {
+                                 $path = common_config('javascript', 'path');
+                             }
+                         }
  
-                     if ($path[0] != '/') {
-                         $path = '/'.$path;
-                     }
+                         $protocol = 'https';
  
-                     $server = common_config('javascript', 'server');
+                     } else {
  
-                     if (empty($server)) {
-                         $server = common_config('site', 'server');
-                     }
+                         $path = common_config('javascript', 'path');
  
-                     $ssl = common_config('javascript', 'ssl');
+                         if (empty($path)) {
+                             $path = common_config('site', 'path') . '/js/';
+                         }
  
-                     if (is_null($ssl)) { // null -> guess
-                         if (common_config('site', 'ssl') == 'always' &&
-                             !common_config('javascript', 'server')) {
-                             $ssl = true;
-                         } else {
-                             $ssl = false;
+                         $server = common_config('javascript', 'server');
+                         if (empty($server)) {
+                             $server = common_config('site', 'server');
                          }
+                         $protocol = 'http';
                      }
  
-                     $protocol = ($ssl) ? 'https' : 'http';
+                     if ($path[strlen($path)-1] != '/') {
+                         $path .= '/';
+                     }
+                     if ($path[0] != '/') {
+                         $path = '/'.$path;
+                     }
  
                      $src = $protocol.'://'.$server.$path.$src . '?version=' . STATUSNET_VERSION;
                  }
              }
  
              $this->element('script', array('type' => $type,
-                                                    'src' => $src),
-                                    ' ');
+                                            'src' => $src),
+                            ' ');
  
              Event::handle('EndScriptElement', array($this,$src,$type));
          }
                  if(file_exists(Theme::file($src,$theme))){
                     $src = Theme::path($src, $theme);
                  }else{
-                    $src = common_path($src);
+                     $src = common_path($src, StatusNet::isHTTPS());
                  }
                  $src.= '?version=' . STATUSNET_VERSION;
              }
diff --combined lib/statusnet.php
index 39f90a5069dffb7a3cd67ff2bba3cd9e5c4ab28d,301994508de630401b1645f010a6e91bfc77dc92..3d018f4e211b54e0f0ebc00d236fbefcf04df55d
@@@ -169,7 -169,6 +169,6 @@@ class StatusNe
          return $sites;
      }
  
      /**
       * Fire initialization events for all instantiated plugins.
       */
      {
          // Load default plugins
          foreach (common_config('plugins', 'default') as $name => $params) {
 +            $key = 'disable-' . $name;
 +            if (common_config('plugins', $key)) {
 +                continue;
 +            }
 +
              if (is_null($params)) {
                  addPlugin($name);
              } else if (is_array($params)) {
      {
          return self::$is_api;
      }
-     
      public function setApi($mode)
      {
          self::$is_api = $mode;
          }
  
          // Backwards compatibility
 -
          if (array_key_exists('memcached', $config)) {
              if ($config['memcached']['enabled']) {
                  addPlugin('Memcache', array('servers' => $config['memcached']['server']));
                  $config['cache']['base'] = $config['memcached']['base'];
              }
          }
 +        if (array_key_exists('xmpp', $config)) {
 +            if ($config['xmpp']['enabled']) {
 +                addPlugin('xmpp', array(
 +                    'server' => $config['xmpp']['server'],
 +                    'port' => $config['xmpp']['port'],
 +                    'user' => $config['xmpp']['user'],
 +                    'resource' => $config['xmpp']['resource'],
 +                    'encryption' => $config['xmpp']['encryption'],
 +                    'password' => $config['xmpp']['password'],
 +                    'host' => $config['xmpp']['host'],
 +                    'debug' => $config['xmpp']['debug'],
 +                    'public' => $config['xmpp']['public']
 +                ));
 +            }
 +        }
      }
+     /**
+      * Are we running from the web with HTTPS?
+      *
+      * @return boolean true if we're running with HTTPS; else false
+      */
+     static function isHTTPS()
+     {
+         // There are some exceptions to this; add them here!
+         return $_SERVER['HTTPS'];
+     }
  }
  
  class NoConfigException extends Exception