- $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
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)
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
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
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.
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
----------
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
----
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
-----
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
----
'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
=======
exit(1);
}
+class ApiValidationException extends Exception { }
+
/**
* Contains most of the Twitter-compatible API output functions.
*
// 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);
}
# 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')
);
'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.)
$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;
}
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