Merge remote-tracking branch 'statusnet/master'
This merges GNU Social with current development of StatusNet. The only conflicts were some documentation, where GNU Social's versions were retained. Conflicts: doc-src/about doc-src/faq plugins/OpenID/doc-src/openid
This commit is contained in:
commit
f79aec36fe
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -5,6 +5,8 @@ file/*
|
|||
local/*
|
||||
_darcs/*
|
||||
logs/*
|
||||
log/*
|
||||
run/*
|
||||
config.php
|
||||
.htaccess
|
||||
httpd.conf
|
||||
|
@ -27,3 +29,4 @@ php.log
|
|||
.DS_Store
|
||||
nbproject
|
||||
*.mo
|
||||
|
||||
|
|
870
CONFIGURE
Normal file
870
CONFIGURE
Normal file
|
@ -0,0 +1,870 @@
|
|||
Configuration options
|
||||
=====================
|
||||
|
||||
The main configuration file for StatusNet (excepting configurations for
|
||||
dependency software) is config.php in your StatusNet directory. If you
|
||||
edit any other file in the directory, like lib/default.php (where most
|
||||
of the defaults are defined), you will lose your configuration options
|
||||
in any upgrade, and you will wish that you had been more careful.
|
||||
|
||||
Starting with version 0.9.0, a Web based configuration panel has been
|
||||
added to StatusNet. The preferred method for changing config options is
|
||||
to use this panel.
|
||||
|
||||
A command-line script, setconfig.php, can be used to set individual
|
||||
configuration options. It's in the scripts/ directory.
|
||||
|
||||
Starting with version 0.7.1, you can put config files in the
|
||||
/etc/statusnet/ directory on your server, if it exists. Config files
|
||||
will be included in this order:
|
||||
|
||||
* /etc/statusnet/statusnet.php - server-wide config
|
||||
* /etc/statusnet/<servername>.php - for a virtual host
|
||||
* /etc/statusnet/<servername>_<pathname>.php - for a path
|
||||
* INSTALLDIR/config.php - for a particular implementation
|
||||
|
||||
Almost all configuration options are made through a two-dimensional
|
||||
associative array, cleverly named $config. A typical configuration
|
||||
line will be:
|
||||
|
||||
$config['section']['option'] = value;
|
||||
|
||||
For brevity, the following documentation describes each section and
|
||||
option.
|
||||
|
||||
site
|
||||
----
|
||||
|
||||
This section is a catch-all for site-wide variables.
|
||||
|
||||
name: the name of your site, like 'YourCompany Microblog'.
|
||||
server: the server part of your site's URLs, like 'example.net'.
|
||||
path: The path part of your site's URLs, like 'statusnet' or ''
|
||||
(installed in root).
|
||||
fancy: whether or not your site uses fancy URLs (see Fancy URLs
|
||||
section above). Default is false.
|
||||
logfile: full path to a file for StatusNet to save logging
|
||||
information to. You may want to use this if you don't have
|
||||
access to syslog.
|
||||
logdebug: whether to log additional debug info like backtraces on
|
||||
hard errors. Default false.
|
||||
locale_path: full path to the directory for locale data. Unless you
|
||||
store all your locale data in one place, you probably
|
||||
don't need to use this.
|
||||
language: default language for your site. Defaults to US English.
|
||||
Note that this is overridden if a user is logged in and has
|
||||
selected a different language. It is also overridden if the
|
||||
user is NOT logged in, but their browser requests a different
|
||||
langauge. Since pretty much everybody's browser requests a
|
||||
language, that means that changing this setting has little or
|
||||
no effect in practice.
|
||||
languages: A list of languages supported on your site. Typically you'd
|
||||
only change this if you wanted to disable support for one
|
||||
or another language:
|
||||
"unset($config['site']['languages']['de'])" will disable
|
||||
support for German.
|
||||
theme: Theme for your site (see Theme section). Two themes are
|
||||
provided by default: 'default' and 'stoica' (the one used by
|
||||
Identi.ca). It's appreciated if you don't use the 'stoica' theme
|
||||
except as the basis for your own.
|
||||
email: contact email address for your site. By default, it's extracted
|
||||
from your Web server environment; you may want to customize it.
|
||||
broughtbyurl: name of an organization or individual who provides the
|
||||
service. Each page will include a link to this name in the
|
||||
footer. A good way to link to the blog, forum, wiki,
|
||||
corporate portal, or whoever is making the service available.
|
||||
broughtby: text used for the "brought by" link.
|
||||
timezone: default timezone for message display. Users can set their
|
||||
own time zone. Defaults to 'UTC', which is a pretty good default.
|
||||
closed: If set to 'true', will disallow registration on your site.
|
||||
This is a cheap way to restrict accounts to only one
|
||||
individual or group; just register the accounts you want on
|
||||
the service, *then* set this variable to 'true'.
|
||||
inviteonly: If set to 'true', will only allow registration if the user
|
||||
was invited by an existing user.
|
||||
private: If set to 'true', anonymous users will be redirected to the
|
||||
'login' page. Also, API methods that normally require no
|
||||
authentication will require it. Note that this does not turn
|
||||
off registration; use 'closed' or 'inviteonly' for the
|
||||
behaviour you want.
|
||||
notice: A plain string that will appear on every page. A good place
|
||||
to put introductory information about your service, or info about
|
||||
upgrades and outages, or other community info. Any HTML will
|
||||
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
|
||||
sensitive pages that include passwords like login and registration,
|
||||
but not for regular pages). Default to 'never'.
|
||||
sslserver: use an alternate server name for SSL URLs, like
|
||||
'secure.example.org'. You should be careful to set cookie
|
||||
parameters correctly so that both the SSL server and the
|
||||
"normal" server can access the session cookie and
|
||||
preferably other cookies as well.
|
||||
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.
|
||||
textlimit: default max size for texts in the site. Defaults to 0 (no limit).
|
||||
Can be fine-tuned for notices, messages, profile bios and group descriptions.
|
||||
|
||||
db
|
||||
--
|
||||
|
||||
This section is a reference to the configuration options for
|
||||
DB_DataObject (see <http://ur1.ca/7xp>). The ones that you may want to
|
||||
set are listed below for clarity.
|
||||
|
||||
database: a DSN (Data Source Name) for your StatusNet database. This is
|
||||
in the format 'protocol://username:password@hostname/databasename',
|
||||
where 'protocol' is 'mysql' or 'mysqli' (or possibly 'postgresql', if you
|
||||
really know what you're doing), 'username' is the username,
|
||||
'password' is the password, and etc.
|
||||
ini_yourdbname: if your database is not named 'statusnet', you'll need
|
||||
to set this to point to the location of the
|
||||
statusnet.ini file. Note that the real name of your database
|
||||
should go in there, not literally 'yourdbname'.
|
||||
db_driver: You can try changing this to 'MDB2' to use the other driver
|
||||
type for DB_DataObject, but note that it breaks the OpenID
|
||||
libraries, which only support PEAR::DB.
|
||||
debug: On a database error, you may get a message saying to set this
|
||||
value to 5 to see debug messages in the browser. This breaks
|
||||
just about all pages, and will also expose the username and
|
||||
password
|
||||
quote_identifiers: Set this to true if you're using postgresql.
|
||||
type: either 'mysql' or 'postgresql' (used for some bits of
|
||||
database-type-specific SQL in the code). Defaults to mysql.
|
||||
mirror: you can set this to an array of DSNs, like the above
|
||||
'database' value. If it's set, certain read-only actions will
|
||||
use a random value out of this array for the database, rather
|
||||
than the one in 'database' (actually, 'database' is overwritten).
|
||||
You can offload a busy DB server by setting up MySQL replication
|
||||
and adding the slaves to this array. Note that if you want some
|
||||
requests to go to the 'database' (master) server, you'll need
|
||||
to include it in this array, too.
|
||||
utf8: whether to talk to the database in UTF-8 mode. This is the default
|
||||
with new installations, but older sites may want to turn it off
|
||||
until they get their databases fixed up. See "UTF-8 database"
|
||||
above for details.
|
||||
schemacheck: when to let plugins check the database schema to add
|
||||
tables or update them. Values can be 'runtime' (default)
|
||||
or 'script'. 'runtime' can be costly (plugins check the
|
||||
schema on every hit, adding potentially several db
|
||||
queries, some quite long), but not everyone knows how to
|
||||
run a script. If you can, set this to 'script' and run
|
||||
scripts/checkschema.php whenever you install or upgrade a
|
||||
plugin.
|
||||
|
||||
syslog
|
||||
------
|
||||
|
||||
By default, StatusNet sites log error messages to the syslog facility.
|
||||
(You can override this using the 'logfile' parameter described above).
|
||||
|
||||
appname: The name that StatusNet uses to log messages. By default it's
|
||||
"statusnet", but if you have more than one installation on the
|
||||
server, you may want to change the name for each instance so
|
||||
you can track log messages more easily.
|
||||
priority: level to log at. Currently ignored.
|
||||
facility: what syslog facility to used. Defaults to LOG_USER, only
|
||||
reset if you know what syslog is and have a good reason
|
||||
to change it.
|
||||
|
||||
queue
|
||||
-----
|
||||
|
||||
You can configure the software to queue time-consuming tasks, like
|
||||
sending out SMS email or XMPP messages, for off-line processing. See
|
||||
'Queues and daemons' above for how to set this up.
|
||||
|
||||
enabled: Whether to uses queues. Defaults to false.
|
||||
subsystem: Which kind of queueserver to use. Values include "db" for
|
||||
our hacked-together database queuing (no other server
|
||||
required) and "stomp" for a stomp server.
|
||||
stomp_server: "broker URI" for stomp server. Something like
|
||||
"tcp://hostname:61613". More complicated ones are
|
||||
possible; see your stomp server's documentation for
|
||||
details.
|
||||
queue_basename: a root name to use for queues (stomp only). Typically
|
||||
something like '/queue/sitename/' makes sense. If running
|
||||
multiple instances on the same server, make sure that
|
||||
either this setting or $config['site']['nickname'] are
|
||||
unique for each site to keep them separate.
|
||||
|
||||
stomp_username: username for connecting to the stomp server; defaults
|
||||
to null.
|
||||
stomp_password: password for connecting to the stomp server; defaults
|
||||
to null.
|
||||
|
||||
stomp_persistent: keep items across queue server restart, if enabled.
|
||||
Under ActiveMQ, the server configuration determines if and how
|
||||
persistent storage is actually saved.
|
||||
|
||||
If using a message queue server other than ActiveMQ, you may
|
||||
need to disable this if it does not support persistence.
|
||||
|
||||
stomp_transactions: use transactions to aid in error detection.
|
||||
A broken transaction will be seen quickly, allowing a message
|
||||
to be redelivered immediately if a daemon crashes.
|
||||
|
||||
If using a message queue server other than ActiveMQ, you may
|
||||
need to disable this if it does not support transactions.
|
||||
|
||||
stomp_acks: send acknowledgements to aid in flow control.
|
||||
An acknowledgement of successful processing tells the server
|
||||
we're ready for more and can help keep things moving smoothly.
|
||||
|
||||
This should *not* be turned off when running with ActiveMQ, but
|
||||
if using another message queue server that does not support
|
||||
acknowledgements you might need to disable this.
|
||||
|
||||
softlimit: an absolute or relative "soft memory limit"; daemons will
|
||||
restart themselves gracefully when they find they've hit
|
||||
this amount of memory usage. Defaults to 90% of PHP's global
|
||||
memory_limit setting.
|
||||
|
||||
inboxes: delivery of messages to receiver's inboxes can be delayed to
|
||||
queue time for best interactive performance on the sender.
|
||||
This may however be annoyingly slow when using the DB queues,
|
||||
so you can set this to false if it's causing trouble.
|
||||
|
||||
breakout: for stomp, individual queues are by default grouped up for
|
||||
best scalability. If some need to be run by separate daemons,
|
||||
etc they can be manually adjusted here.
|
||||
|
||||
Default will share all queues for all sites within each group.
|
||||
Specify as <group>/<queue> or <group>/<queue>/<site>,
|
||||
using nickname identifier as site.
|
||||
|
||||
'main/distrib' separate "distrib" queue covering all sites
|
||||
'xmpp/xmppout/mysite' separate "xmppout" queue covering just 'mysite'
|
||||
|
||||
max_retries: for stomp, drop messages after N failed attempts to process.
|
||||
Defaults to 10.
|
||||
|
||||
dead_letter_dir: for stomp, optional directory to dump data on failed
|
||||
queue processing events after discarding them.
|
||||
|
||||
stomp_no_transactions: for stomp, the server does not support transactions,
|
||||
so do not try to user them. This is needed for http://www.morbidq.com/.
|
||||
|
||||
stomp_no_acks: for stomp, the server does not support acknowledgements.
|
||||
so do not try to user them. This is needed for http://www.morbidq.com/.
|
||||
|
||||
license
|
||||
-------
|
||||
|
||||
The default license to use for your users notices. The default is the
|
||||
Creative Commons Attribution 3.0 license, which is probably the right
|
||||
choice for any public site. Note that some other servers will not
|
||||
accept notices if you apply a stricter license than this.
|
||||
|
||||
type: one of 'cc' (for Creative Commons licenses), 'allrightsreserved'
|
||||
(default copyright), or 'private' (for private and confidential
|
||||
information).
|
||||
owner: for 'allrightsreserved' or 'private', an assigned copyright
|
||||
holder (for example, an employer for a private site). If
|
||||
not specified, will be attributed to 'contributors'.
|
||||
url: URL of the license, used for links.
|
||||
title: Title for the license, like 'Creative Commons Attribution 3.0'.
|
||||
image: A button shown on each page for the license.
|
||||
|
||||
mail
|
||||
----
|
||||
|
||||
This is for configuring out-going email. We use PEAR's Mail module,
|
||||
see: http://pear.php.net/manual/en/package.mail.mail.factory.php
|
||||
|
||||
backend: the backend to use for mail, one of 'mail', 'sendmail', and
|
||||
'smtp'. Defaults to PEAR's default, 'mail'.
|
||||
params: if the mail backend requires any parameters, you can provide
|
||||
them in an associative array.
|
||||
|
||||
nickname
|
||||
--------
|
||||
|
||||
This is for configuring nicknames in the service.
|
||||
|
||||
blacklist: an array of strings for usernames that may not be
|
||||
registered. A default array exists for strings that are
|
||||
used by StatusNet (e.g. 'doc', 'main', 'avatar', 'theme')
|
||||
but you may want to add others if you have other software
|
||||
installed in a subdirectory of StatusNet or if you just
|
||||
don't want certain words used as usernames.
|
||||
featured: an array of nicknames of 'featured' users of the site.
|
||||
Can be useful to draw attention to well-known users, or
|
||||
interesting people, or whatever.
|
||||
|
||||
avatar
|
||||
------
|
||||
|
||||
For configuring avatar access.
|
||||
|
||||
dir: Directory to look for avatar files and to put them into.
|
||||
Defaults to avatar subdirectory of install directory; if
|
||||
you change it, make sure to change path, too.
|
||||
path: Path to avatars. Defaults to path for avatar subdirectory,
|
||||
but you can change it if you wish. Note that this will
|
||||
be included with the avatar server, too.
|
||||
server: If set, defines another server where avatars are stored in the
|
||||
root directory. Note that the 'avatar' subdir still has to be
|
||||
writeable. You'd typically use this to split HTTP requests on
|
||||
the client to speed up page loading, either with another
|
||||
virtual server or with an NFS or SAMBA share. Clients
|
||||
typically only make 2 connections to a single server at a
|
||||
time <http://ur1.ca/6ih>, so this can parallelize the job.
|
||||
Defaults to null.
|
||||
ssl: Whether to access avatars using HTTPS. Defaults to null, meaning
|
||||
to guess based on site-wide SSL settings.
|
||||
|
||||
public
|
||||
------
|
||||
|
||||
For configuring the public stream.
|
||||
|
||||
localonly: If set to true, only messages posted by users of this
|
||||
service (rather than other services, filtered through OStatus)
|
||||
are shown in the public stream. Default true.
|
||||
blacklist: An array of IDs of users to hide from the public stream.
|
||||
Useful if you have someone making excessive Twitterfeed posts
|
||||
to the site, other kinds of automated posts, testing bots, etc.
|
||||
autosource: Sources of notices that are from automatic posters, and thus
|
||||
should be kept off the public timeline. Default empty.
|
||||
|
||||
theme
|
||||
-----
|
||||
|
||||
server: Like avatars, you can speed up page loading by pointing the
|
||||
theme file lookup to another server (virtual or real).
|
||||
Defaults to NULL, meaning to use the site server.
|
||||
dir: Directory where theme files are stored. Used to determine
|
||||
whether to show parts of a theme file. Defaults to the theme
|
||||
subdirectory of the install directory.
|
||||
path: Path part of theme URLs, before the theme name. Relative to the
|
||||
theme server. It may make sense to change this path when upgrading,
|
||||
(using version numbers as the path) to make sure that all files are
|
||||
reloaded by caching clients or proxies. Defaults to null,
|
||||
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
|
||||
----------
|
||||
|
||||
server: You can speed up page loading by pointing the
|
||||
theme file lookup to another server (virtual or real).
|
||||
Defaults to NULL, meaning to use the site server.
|
||||
path: Path part of Javascript URLs. Defaults to null,
|
||||
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.
|
||||
bustframes: If true, all web pages will break out of framesets. If false,
|
||||
can comfortably live in a frame or iframe... probably. Default
|
||||
to true.
|
||||
|
||||
xmpp
|
||||
----
|
||||
|
||||
For configuring the XMPP sub-system.
|
||||
|
||||
enabled: Whether to accept and send messages by XMPP. Default false.
|
||||
server: server part of XMPP ID for update user.
|
||||
port: connection port for clients. Default 5222, which you probably
|
||||
shouldn't need to change.
|
||||
user: username for the client connection. Users will receive messages
|
||||
from 'user'@'server'.
|
||||
resource: a unique identifier for the connection to the server. This
|
||||
is actually used as a prefix for each XMPP component in the system.
|
||||
password: password for the user account.
|
||||
host: some XMPP domains are served by machines with a different
|
||||
hostname. (For example, @gmail.com GTalk users connect to
|
||||
talk.google.com). Set this to the correct hostname if that's the
|
||||
case with your server.
|
||||
encryption: Whether to encrypt the connection between StatusNet and the
|
||||
XMPP server. Defaults to true, but you can get
|
||||
considerably better performance turning it off if you're
|
||||
connecting to a server on the same machine or on a
|
||||
protected network.
|
||||
debug: if turned on, this will make the XMPP library blurt out all of
|
||||
the incoming and outgoing messages as XML stanzas. Use as a
|
||||
last resort, and never turn it on if you don't have queues
|
||||
enabled, since it will spit out sensitive data to the browser.
|
||||
public: an array of JIDs to send _all_ notices to. This is useful for
|
||||
participating in third-party search and archiving services.
|
||||
|
||||
invite
|
||||
------
|
||||
|
||||
For configuring invites.
|
||||
|
||||
enabled: Whether to allow users to send invites. Default true.
|
||||
|
||||
tag
|
||||
---
|
||||
|
||||
Miscellaneous tagging stuff.
|
||||
|
||||
dropoff: Decay factor for tag listing, in seconds.
|
||||
Defaults to exponential decay over ten days; you can twiddle
|
||||
with it to try and get better results for your site.
|
||||
|
||||
popular
|
||||
-------
|
||||
|
||||
Settings for the "popular" section of the site.
|
||||
|
||||
dropoff: Decay factor for popularity listing, in seconds.
|
||||
Defaults to exponential decay over ten days; you can twiddle
|
||||
with it to try and get better results for your site.
|
||||
|
||||
daemon
|
||||
------
|
||||
|
||||
For daemon processes.
|
||||
|
||||
piddir: directory that daemon processes should write their PID file
|
||||
(process ID) to. Defaults to /var/run/, which is where this
|
||||
stuff should usually go on Unix-ish systems.
|
||||
user: If set, the daemons will try to change their effective user ID
|
||||
to this user before running. Probably a good idea, especially if
|
||||
you start the daemons as root. Note: user name, like 'daemon',
|
||||
not 1001.
|
||||
group: If set, the daemons will try to change their effective group ID
|
||||
to this named group. Again, a name, not a numerical ID.
|
||||
|
||||
memcached
|
||||
---------
|
||||
|
||||
You can get a significant boost in performance by caching some
|
||||
database data in memcached <http://www.danga.com/memcached/>.
|
||||
|
||||
enabled: Set to true to enable. Default false.
|
||||
server: a string with the hostname of the memcached server. Can also
|
||||
be an array of hostnames, if you've got more than one server.
|
||||
base: memcached uses key-value pairs to store data. We build long,
|
||||
funny-looking keys to make sure we don't have any conflicts. The
|
||||
base of the key is usually a simplified version of the site name
|
||||
(like "Identi.ca" => "identica"), but you can overwrite this if
|
||||
you need to. You can safely ignore it if you only have one
|
||||
StatusNet site using your memcached server.
|
||||
port: Port to connect to; defaults to 11211.
|
||||
|
||||
emailpost
|
||||
---------
|
||||
|
||||
For post-by-email.
|
||||
|
||||
enabled: Whether to enable post-by-email. Defaults to true. You will
|
||||
also need to set up maildaemon.php.
|
||||
|
||||
sms
|
||||
---
|
||||
|
||||
For SMS integration.
|
||||
|
||||
enabled: Whether to enable SMS integration. Defaults to true. Queues
|
||||
should also be enabled.
|
||||
|
||||
integration
|
||||
-----------
|
||||
|
||||
A catch-all for integration with other systems.
|
||||
|
||||
taguri: base for tag:// URIs. Defaults to site-server + ',2009'.
|
||||
|
||||
inboxes
|
||||
-------
|
||||
|
||||
For notice inboxes.
|
||||
|
||||
enabled: No longer used. If you set this to something other than true,
|
||||
StatusNet will no longer run.
|
||||
|
||||
throttle
|
||||
--------
|
||||
|
||||
For notice-posting throttles.
|
||||
|
||||
enabled: Whether to throttle posting. Defaults to false.
|
||||
count: Each user can make this many posts in 'timespan' seconds. So, if count
|
||||
is 100 and timespan is 3600, then there can be only 100 posts
|
||||
from a user every hour.
|
||||
timespan: see 'count'.
|
||||
|
||||
profile
|
||||
-------
|
||||
|
||||
Profile management.
|
||||
|
||||
biolimit: max character length of bio; 0 means no limit; null means to use
|
||||
the site text limit default.
|
||||
backup: whether users can backup their own profiles. Defaults to true.
|
||||
restore: whether users can restore their profiles from backup files. Defaults
|
||||
to true.
|
||||
delete: whether users can delete their own accounts. Defaults to false.
|
||||
move: whether users can move their accounts to another server. Defaults
|
||||
to true.
|
||||
|
||||
newuser
|
||||
-------
|
||||
|
||||
Options with new users.
|
||||
|
||||
default: nickname of a user account to automatically subscribe new
|
||||
users to. Typically this would be system account for e.g.
|
||||
service updates or announcements. Users are able to unsub
|
||||
if they want. Default is null; no auto subscribe.
|
||||
welcome: nickname of a user account that sends welcome messages to new
|
||||
users. Can be the same as 'default' account, although on
|
||||
busy servers it may be a good idea to keep that one just for
|
||||
'urgent' messages. Default is null; no message.
|
||||
|
||||
If either of these special user accounts are specified, the users should
|
||||
be created before the configuration is updated.
|
||||
|
||||
snapshot
|
||||
--------
|
||||
|
||||
The software will, by default, send statistical snapshots about the
|
||||
local installation to a stats server on the status.net Web site. This
|
||||
data is used by the developers to prioritize development decisions. No
|
||||
identifying data about users or organizations is collected. The data
|
||||
is available to the public for review. Participating in this survey
|
||||
helps StatusNet developers take your needs into account when updating
|
||||
the software.
|
||||
|
||||
run: string indicating when to run the statistics. Values can be 'web'
|
||||
(run occasionally at Web time), 'cron' (run from a cron script),
|
||||
or 'never' (don't ever run). If you set it to 'cron', remember to
|
||||
schedule the script to run on a regular basis.
|
||||
frequency: if run value is 'web', how often to report statistics.
|
||||
Measured in Web hits; depends on how active your site is.
|
||||
Default is 10000 -- that is, one report every 10000 Web hits,
|
||||
on average.
|
||||
reporturl: URL to post statistics to. Defaults to StatusNet developers'
|
||||
report system, but if they go evil or disappear you may
|
||||
need to update this to another value. Note: if you
|
||||
don't want to report stats, it's much better to
|
||||
set 'run' to 'never' than to set this value to something
|
||||
nonsensical.
|
||||
|
||||
attachments
|
||||
-----------
|
||||
|
||||
The software lets users upload files with their notices. You can configure
|
||||
the types of accepted files by mime types and a trio of quota options:
|
||||
per file, per user (total), per user per month.
|
||||
|
||||
We suggest the use of the pecl file_info extension to handle mime type
|
||||
detection.
|
||||
|
||||
supported: an array of mime types you accept to store and distribute,
|
||||
like 'image/gif', 'video/mpeg', 'audio/mpeg', etc. Make sure you
|
||||
setup your server to properly recognize the types you want to
|
||||
support.
|
||||
uploads: false to disable uploading files with notices (true by default).
|
||||
filecommand: The required MIME_Type library may need to use the 'file'
|
||||
command. It tries the one in the Web server's path, but if
|
||||
you're having problems with uploads, try setting this to the
|
||||
correct value. Note: 'file' must accept '-b' and '-i' options.
|
||||
|
||||
For quotas, be sure you've set the upload_max_filesize and post_max_size
|
||||
in php.ini to be large enough to handle your upload. In httpd.conf
|
||||
(if you're using apache), check that the LimitRequestBody directive isn't
|
||||
set too low (it's optional, so it may not be there at all).
|
||||
|
||||
file_quota: maximum size for a single file upload in bytes. A user can send
|
||||
any amount of notices with attachments as long as each attachment
|
||||
is smaller than file_quota.
|
||||
user_quota: total size in bytes a user can store on this server. Each user
|
||||
can store any number of files as long as their total size does
|
||||
not exceed the user_quota.
|
||||
monthly_quota: total size permitted in the current month. This is the total
|
||||
size in bytes that a user can upload each month.
|
||||
dir: directory accessible to the Web process where uploads should go.
|
||||
Defaults to the 'file' subdirectory of the install directory, which
|
||||
should be writeable by the Web user.
|
||||
server: server name to use when creating URLs for uploaded files.
|
||||
Defaults to null, meaning to use the default Web server. Using
|
||||
a virtual server here can speed up Web performance.
|
||||
path: URL path, relative to the server, to find files. Defaults to
|
||||
main path + '/file/'.
|
||||
ssl: whether to use HTTPS for file URLs. Defaults to null, meaning to
|
||||
guess based on other SSL settings.
|
||||
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
|
||||
-----
|
||||
|
||||
Options for group functionality.
|
||||
|
||||
maxaliases: maximum number of aliases a group can have. Default 3. Set
|
||||
to 0 or less to prevent aliases in a group.
|
||||
desclimit: maximum number of characters to allow in group descriptions.
|
||||
null (default) means to use the site-wide text limits. 0
|
||||
means no limit.
|
||||
addtag: Whether to add a tag for the group nickname for every group post
|
||||
(pre-1.0.x behaviour). Defaults to false.
|
||||
|
||||
oembed
|
||||
--------
|
||||
|
||||
oEmbed endpoint for multimedia attachments (links in posts). Will also
|
||||
work as 'oohembed' for backwards compatibility.
|
||||
|
||||
endpoint: oohembed endpoint using http://oohembed.com/ software. Defaults to
|
||||
'http://oohembed.com/oohembed/'.
|
||||
order: Array of methods to check for OEmbed data. Methods include 'built-in'
|
||||
(use a built-in function to simulate oEmbed for some sites),
|
||||
'well-known' (use well-known public oEmbed endpoints),
|
||||
'discovery' (discover using <link> headers in HTML), 'service' (use
|
||||
a third-party service, like oohembed or embed.ly. Default is
|
||||
array('built-in', 'well-known', 'service', 'discovery'). Note that very
|
||||
few sites implement oEmbed; 'discovery' is going to fail 99% of the
|
||||
time.
|
||||
|
||||
search
|
||||
------
|
||||
|
||||
Some stuff for search.
|
||||
|
||||
type: type of search. Ignored if PostgreSQL or Sphinx are enabled. Can either
|
||||
be 'fulltext' or 'like' (default). The former is faster and more efficient
|
||||
but requires the lame old MyISAM engine for MySQL. The latter
|
||||
will work with InnoDB but could be miserably slow on large
|
||||
systems. We'll probably add another type sometime in the future,
|
||||
with our own indexing system (maybe like MediaWiki's).
|
||||
|
||||
sessions
|
||||
--------
|
||||
|
||||
Session handling.
|
||||
|
||||
handle: boolean. Whether we should register our own PHP session-handling
|
||||
code (using the database and memcache if enabled). Defaults to false.
|
||||
Setting this to true makes some sense on large or multi-server
|
||||
sites, but it probably won't hurt for smaller ones, either.
|
||||
debug: whether to output debugging info for session storage. Can help
|
||||
with weird session bugs, sometimes. Default false.
|
||||
|
||||
background
|
||||
----------
|
||||
|
||||
Users can upload backgrounds for their pages; this section defines
|
||||
their use.
|
||||
|
||||
server: the server to use for background. Using a separate (even
|
||||
virtual) server for this can speed up load times. Default is
|
||||
null; same as site server.
|
||||
dir: directory to write backgrounds too. Default is '/background/'
|
||||
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.
|
||||
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
|
||||
----
|
||||
|
||||
Using the "XML-RPC Ping" method initiated by weblogs.com, the site can
|
||||
notify third-party servers of updates.
|
||||
|
||||
notify: an array of URLs for ping endpoints. Default is the empty
|
||||
array (no notification).
|
||||
|
||||
design
|
||||
------
|
||||
|
||||
Default design (colors and background) for the site. Actual appearance
|
||||
depends on the theme. Null values mean to use the theme defaults.
|
||||
|
||||
backgroundcolor: Hex color of the site background.
|
||||
contentcolor: Hex color of the content area background.
|
||||
sidebarcolor: Hex color of the sidebar background.
|
||||
textcolor: Hex color of all non-link text.
|
||||
linkcolor: Hex color of all links.
|
||||
backgroundimage: Image to use for the background.
|
||||
disposition: Flags for whether or not to tile the background image.
|
||||
|
||||
notice
|
||||
------
|
||||
|
||||
Configuration options specific to notices.
|
||||
|
||||
contentlimit: max length of the plain-text content of a notice.
|
||||
Default is null, meaning to use the site-wide text limit.
|
||||
0 means no limit.
|
||||
defaultscope: default scope for notices. If null, the default
|
||||
scope depends on site/private. It's 1 if the site is private,
|
||||
0 otherwise. Set this value to override.
|
||||
|
||||
message
|
||||
-------
|
||||
|
||||
Configuration options specific to messages.
|
||||
|
||||
contentlimit: max length of the plain-text content of a message.
|
||||
Default is null, meaning to use the site-wide text limit.
|
||||
0 means no limit.
|
||||
|
||||
logincommand
|
||||
------------
|
||||
|
||||
Configuration options for the login command.
|
||||
|
||||
disabled: whether to enable this command. If enabled, users who send
|
||||
the text 'login' to the site through any channel will
|
||||
receive a link to login to the site automatically in return.
|
||||
Possibly useful for users who primarily use an XMPP or SMS
|
||||
interface and can't be bothered to remember their site
|
||||
password. Note that the security implications of this are
|
||||
pretty serious and have not been thoroughly tested. You
|
||||
should enable it only after you've convinced yourself that
|
||||
it is safe. Default is 'false'.
|
||||
|
||||
singleuser
|
||||
----------
|
||||
|
||||
If an installation has only one user, this can simplify a lot of the
|
||||
interface. It also makes the user's profile the root URL.
|
||||
|
||||
enabled: Whether to run in "single user mode". Default false.
|
||||
nickname: nickname of the single user. If no nickname is specified,
|
||||
the site owner account will be used (if present).
|
||||
|
||||
robotstxt
|
||||
---------
|
||||
|
||||
We put out a default robots.txt file to guide the processing of
|
||||
Web crawlers. See http://www.robotstxt.org/ for more information
|
||||
on the format of this file.
|
||||
|
||||
crawldelay: if non-empty, this value is provided as the Crawl-Delay:
|
||||
for the robots.txt file. see http://ur1.ca/l5a0
|
||||
for more information. Default is zero, no explicit delay.
|
||||
disallow: Array of (virtual) directories to disallow. Default is 'main',
|
||||
'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.
|
||||
|
||||
router
|
||||
------
|
||||
|
||||
We use a router class for mapping URLs to code. This section controls
|
||||
how that router works.
|
||||
|
||||
cache: whether to cache the router in memcache (or another caching
|
||||
mechanism). Defaults to true, but may be set to false for
|
||||
developers (who might be actively adding pages, so won't want the
|
||||
router cached) or others who see strange behavior. You're unlikely
|
||||
to need this unless you're a developer.
|
||||
|
||||
http
|
||||
----
|
||||
|
||||
Settings for the HTTP client.
|
||||
|
||||
ssl_cafile: location of the CA file for SSL. If not set, won't verify
|
||||
SSL peers. Default unset.
|
||||
curl: Use cURL <http://curl.haxx.se/> for doing HTTP calls. You must
|
||||
have the PHP curl extension installed for this to work.
|
||||
proxy_host: Host to use for proxying HTTP requests. If unset, doesn't
|
||||
do any HTTP proxy stuff. Default unset.
|
||||
proxy_port: Port to use to connect to HTTP proxy host. Default null.
|
||||
proxy_user: Username to use for authenticating to the HTTP proxy. Default null.
|
||||
proxy_password: Password to use for authenticating to the HTTP proxy. Default null.
|
||||
proxy_auth_scheme: Scheme to use for authenticating to the HTTP proxy. Default null.
|
||||
|
||||
plugins
|
||||
-------
|
||||
|
||||
default: associative array mapping plugin name to array of arguments. To disable
|
||||
a default plugin, unset its value in this array.
|
||||
locale_path: path for finding plugin locale files. In the plugin's directory
|
||||
by default.
|
||||
server: Server to find static files for a plugin when the page is plain old HTTP.
|
||||
Defaults to site/server (same as pages). Use this to move plugin CSS and
|
||||
JS files to a CDN.
|
||||
sslserver: Server to find static files for a plugin when the page is HTTPS. Defaults
|
||||
to site/server (same as pages). Use this to move plugin CSS and JS files
|
||||
to a CDN.
|
||||
path: Path to the plugin files. defaults to site/path + '/plugins/'. Expects that
|
||||
each plugin will have a subdirectory at plugins/NameOfPlugin. Change this
|
||||
if you're using a CDN.
|
||||
sslpath: Path to use on the SSL server. Same as plugins/path.
|
||||
|
||||
performance
|
||||
-----------
|
||||
|
||||
high: if you need high performance, or if you're seeing bad
|
||||
performance, set this to true. It will turn off some high-intensity code from
|
||||
the site.
|
||||
|
||||
oldschool
|
||||
---------
|
||||
|
||||
enabled: enable certain old-style user settings options, like stream-only mode,
|
||||
conversation trees, and nicknames in streams. Off by default, and
|
||||
may not be well supported in future versions.
|
||||
|
||||
|
38
EVENTS.txt
38
EVENTS.txt
|
@ -1418,3 +1418,41 @@ StartShowInvitationSuccess: Right before showing invitations success msg
|
|||
EndShowInvitationSuccess: After showing invitations success msg
|
||||
- $action: invitation action
|
||||
|
||||
StartUpgrade: when starting a site upgrade
|
||||
|
||||
EndUpgrade: when ending a site upgrade; good place to do your own upgrades
|
||||
|
||||
HaveIMPlugin: is there an IM plugin loaded?
|
||||
- &$haveIMPlugin: set me to true if you're loaded!
|
||||
|
||||
StartShowNoticeOptionItems: Before showing first controls in a notice list item; inside the div
|
||||
- $nli: NoticeListItem being shown
|
||||
|
||||
EndShowNoticeOptionItems: After showing last controls in a notice list item; inside the div
|
||||
- $nli: NoticeListItem being shown
|
||||
|
||||
StartNoticeInScope: Before checking if a notice should be visible to a user
|
||||
- $notice: The notice to check
|
||||
- $profile: The profile to check for scope
|
||||
- &$bResult: The boolean result; fill this in if you want to skip
|
||||
|
||||
EndNoticeInScope: After checking if a notice should be visible to a user
|
||||
- $notice: The notice to check
|
||||
- $profile: The profile to check for scope
|
||||
- &$bResult: The boolean result; overwrite this if you so desire
|
||||
|
||||
StartNoticeListPrefill: Before pre-filling a list of notices with extra data
|
||||
- &$notices: Notices to be pre-filled
|
||||
- $avatarSize: The avatar size for the list
|
||||
|
||||
EndNoticeListPrefill: After pre-filling a list of notices with extra data
|
||||
- &$notices: Notices that were pre-filled
|
||||
- &$profiles: Profiles that were pre-filled
|
||||
- $avatarSize: The avatar size for the list
|
||||
|
||||
OtherAccountProfiles: Hook to add account profiles to a user account profile block
|
||||
- $profile: the Profile being shown
|
||||
- &$others: Modifiable array of profile info arrays. Each one has the following fields:
|
||||
href: link to the profile
|
||||
text: text for the profile
|
||||
image: mini image for the profile
|
||||
|
|
516
INSTALL
Normal file
516
INSTALL
Normal file
|
@ -0,0 +1,516 @@
|
|||
Prerequisites
|
||||
=============
|
||||
|
||||
The following software packages are *required* for this software to
|
||||
run correctly.
|
||||
|
||||
- PHP 5.2.3+. It may be possible to run this software on earlier
|
||||
versions of PHP, but many of the functions used are only available
|
||||
in PHP 5.2 or above. 5.2.6 or later is needed for XMPP background
|
||||
daemons on 64-bit platforms. PHP 5.3.x should work correctly in this
|
||||
release, but problems with some plugins are possible.
|
||||
- MySQL 5.x. The StatusNet database is stored, by default, in a MySQL
|
||||
server. It has been primarily tested on 5.x servers, although it may
|
||||
be possible to install on earlier (or later!) versions. The server
|
||||
*must* support the MyISAM storage engine -- the default for most
|
||||
MySQL servers -- *and* the InnoDB storage engine.
|
||||
- A Web server. Preferably, you should have Apache 2.2.x with the
|
||||
mod_rewrite extension installed and enabled.
|
||||
|
||||
Your PHP installation must include the following PHP extensions:
|
||||
|
||||
- Curl. This is for fetching files by HTTP.
|
||||
- XMLWriter. This is for formatting XML and HTML output.
|
||||
- MySQL. For accessing the database.
|
||||
- GD. For scaling down avatar images.
|
||||
- mbstring. For handling Unicode (UTF-8) encoded strings.
|
||||
|
||||
For some functionality, you will also need the following extensions:
|
||||
|
||||
- Memcache. A client for the memcached server, which caches database
|
||||
information in volatile memory. This is important for adequate
|
||||
performance on high-traffic sites. You will also need a memcached
|
||||
server to store the data in.
|
||||
- Mailparse. Efficient parsing of email requires this extension.
|
||||
Submission by email or SMS-over-email uses this extension.
|
||||
- Sphinx Search. A client for the sphinx server, an alternative
|
||||
to MySQL or Postgresql fulltext search. You will also need a
|
||||
Sphinx server to serve the search queries.
|
||||
- bcmath or gmp. For Salmon signatures (part of OStatus). Needed
|
||||
if you have OStatus configured.
|
||||
- gettext. For multiple languages. Default on many PHP installs;
|
||||
will be emulated if not present.
|
||||
|
||||
You will almost definitely get 2-3 times better performance from your
|
||||
site if you install a PHP bytecode cache/accelerator. Some well-known
|
||||
examples are: eaccelerator, Turck mmcache, xcache, apc. Zend Optimizer
|
||||
is a proprietary accelerator installed on some hosting sites.
|
||||
|
||||
External libraries
|
||||
------------------
|
||||
|
||||
A number of external PHP libraries are used to provide basic
|
||||
functionality and optional functionality for your system. For your
|
||||
convenience, they are available in the "extlib" directory of this
|
||||
package, and you do not have to download and install them. However,
|
||||
you may want to keep them up-to-date with the latest upstream version,
|
||||
and the URLs are listed here for your convenience.
|
||||
|
||||
- DB_DataObject http://pear.php.net/package/DB_DataObject
|
||||
- Validate http://pear.php.net/package/Validate
|
||||
- OpenID from OpenIDEnabled (not the PEAR version!). We decided
|
||||
to use the openidenabled.com version since it's more widely
|
||||
implemented, and seems to be better supported.
|
||||
http://openidenabled.com/php-openid/
|
||||
- PEAR DB. Although this is an older data access system (new
|
||||
packages should probably use PHP DBO), the OpenID libraries
|
||||
depend on PEAR DB so we use it here, too. DB_DataObject can
|
||||
also use PEAR MDB2, which may give you better performance
|
||||
but won't work with OpenID.
|
||||
http://pear.php.net/package/DB
|
||||
- OAuth.php from http://oauth.googlecode.com/svn/code/php/
|
||||
- markdown.php from http://michelf.com/projects/php-markdown/
|
||||
- PEAR Mail, for sending out mail notifications
|
||||
http://pear.php.net/package/Mail
|
||||
- PEAR Net_SMTP, if you use the SMTP factory for notifications
|
||||
http://pear.php.net/package/Net_SMTP
|
||||
- PEAR Net_Socket, if you use the SMTP factory for notifications
|
||||
http://pear.php.net/package/Net_Socket
|
||||
- XMPPHP, the follow-up to Class.Jabber.php. Probably the best XMPP
|
||||
library available for PHP. http://xmpphp.googlecode.com/. Note that
|
||||
as of this writing the version of this library that is available in
|
||||
the extlib directory is *significantly different* from the upstream
|
||||
version (patches have been submitted). Upgrading to the upstream
|
||||
version may render your StatusNet site unable to send or receive XMPP
|
||||
messages.
|
||||
- Facebook library. Used for the Facebook application.
|
||||
- PEAR Validate is used for URL and email validation.
|
||||
- Console_GetOpt for parsing command-line options.
|
||||
predecessor to OStatus.
|
||||
- HTTP_Request2, a library for making HTTP requests.
|
||||
- PEAR Net_URL2 is an HTTP_Request2 dependency.
|
||||
|
||||
A design goal of StatusNet is that the basic Web functionality should
|
||||
work on even the most restrictive commercial hosting services.
|
||||
However, additional functionality, such as receiving messages by
|
||||
Jabber/GTalk, require that you be able to run long-running processes
|
||||
on your account. In addition, posting by email or from SMS require
|
||||
that you be able to install a mail filter in your mail server.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Installing the basic StatusNet Web component is relatively easy,
|
||||
especially if you've previously installed PHP/MySQL packages.
|
||||
|
||||
1. Unpack the tarball you downloaded on your Web server. Usually a
|
||||
command like this will work:
|
||||
|
||||
tar zxf statusnet-1.1.1.tar.gz
|
||||
|
||||
...which will make a statusnet-1.1.1 subdirectory in your current
|
||||
directory. (If you don't have shell access on your Web server, you
|
||||
may have to unpack the tarball on your local computer and FTP the
|
||||
files to the server.)
|
||||
|
||||
2. Move the tarball to a directory of your choosing in your Web root
|
||||
directory. Usually something like this will work:
|
||||
|
||||
mv statusnet-1.1.1 /var/www/statusnet
|
||||
|
||||
This will make your StatusNet instance available in the statusnet path of
|
||||
your server, like "http://example.net/statusnet". "microblog" or
|
||||
"statusnet" might also be good path names. If you know how to
|
||||
configure virtual hosts on your web server, you can try setting up
|
||||
"http://micro.example.net/" or the like.
|
||||
|
||||
3. Make your target directory writeable by the Web server.
|
||||
|
||||
chmod a+w /var/www/statusnet/
|
||||
|
||||
On some systems, this will probably work:
|
||||
|
||||
chgrp www-data /var/www/statusnet/
|
||||
chmod g+w /var/www/statusnet/
|
||||
|
||||
If your Web server runs as another user besides "www-data", try
|
||||
that user's default group instead. As a last resort, you can create
|
||||
a new group like "statusnet" and add the Web server's user to the group.
|
||||
|
||||
4. You should also take this moment to make your avatar, background, and
|
||||
file subdirectories writeable by the Web server. An insecure way to do
|
||||
this is:
|
||||
|
||||
chmod a+w /var/www/statusnet/avatar
|
||||
chmod a+w /var/www/statusnet/background
|
||||
chmod a+w /var/www/statusnet/file
|
||||
|
||||
You can also make the avatar, background, and file directories
|
||||
writeable by the Web server group, as noted above.
|
||||
|
||||
5. Create a database to hold your microblog data. Something like this
|
||||
should work:
|
||||
|
||||
mysqladmin -u "username" --password="password" create statusnet
|
||||
|
||||
Note that StatusNet must have its own database; you can't share the
|
||||
database with another program. You can name it whatever you want,
|
||||
though.
|
||||
|
||||
(If you don't have shell access to your server, you may need to use
|
||||
a tool like PHPAdmin to create a database. Check your hosting
|
||||
service's documentation for how to create a new MySQL database.)
|
||||
|
||||
6. Create a new database account that StatusNet will use to access the
|
||||
database. If you have shell access, this will probably work from the
|
||||
MySQL shell:
|
||||
|
||||
GRANT ALL on statusnet.*
|
||||
TO 'statusnetuser'@'localhost'
|
||||
IDENTIFIED BY 'statusnetpassword';
|
||||
|
||||
You should change 'statusnetuser' and 'statusnetpassword' to your preferred new
|
||||
username and password. You may want to test logging in to MySQL as
|
||||
this new user.
|
||||
|
||||
7. In a browser, navigate to the StatusNet install script; something like:
|
||||
|
||||
http://yourserver.example.com/statusnet/install.php
|
||||
|
||||
Enter the database connection information and your site name. The
|
||||
install program will configure your site and install the initial,
|
||||
almost-empty database.
|
||||
|
||||
8. You should now be able to navigate to your microblog's main directory
|
||||
and see the "Public Timeline", which will be empty. If not, magic
|
||||
has happened! You can now register a new user, post some notices,
|
||||
edit your profile, etc. However, you may want to wait to do that stuff
|
||||
if you think you can set up "fancy URLs" (see below), since some
|
||||
URLs are stored in the database.
|
||||
|
||||
Fancy URLs
|
||||
----------
|
||||
|
||||
By default, StatusNet will use URLs that include the main PHP program's
|
||||
name in them. For example, a user's home profile might be
|
||||
found at:
|
||||
|
||||
http://example.org/statusnet/index.php/statusnet/fred
|
||||
|
||||
On certain systems that don't support this kind of syntax, they'll
|
||||
look like this:
|
||||
|
||||
http://example.org/statusnet/index.php?p=statusnet/fred
|
||||
|
||||
It's possible to configure the software so it looks like this instead:
|
||||
|
||||
http://example.org/statusnet/fred
|
||||
|
||||
These "fancy URLs" are more readable and memorable for users. To use
|
||||
fancy URLs, you must either have Apache 2.x with .htaccess enabled and
|
||||
mod_rewrite enabled, -OR- know how to configure "url redirection" in
|
||||
your server.
|
||||
|
||||
1. Copy the htaccess.sample file to .htaccess in your StatusNet
|
||||
directory. Note: if you have control of your server's httpd.conf or
|
||||
similar configuration files, it can greatly improve performance to
|
||||
import the .htaccess file into your conf file instead. If you're
|
||||
not sure how to do it, you may save yourself a lot of headache by
|
||||
just leaving the .htaccess file.
|
||||
|
||||
2. Change the "RewriteBase" in the new .htaccess file to be the URL path
|
||||
to your StatusNet installation on your server. Typically this will
|
||||
be the path to your StatusNet directory relative to your Web root.
|
||||
|
||||
3. Add or uncomment or change a line in your config.php file so it says:
|
||||
|
||||
$config['site']['fancy'] = true;
|
||||
|
||||
You should now be able to navigate to a "fancy" URL on your server,
|
||||
like:
|
||||
|
||||
http://example.net/statusnet/main/register
|
||||
|
||||
If you changed your HTTP server configuration, you may need to restart
|
||||
the server first.
|
||||
|
||||
If it doesn't work, double-check that AllowOverride for the StatusNet
|
||||
directory is 'All' in your Apache configuration file. This is usually
|
||||
/etc/httpd.conf, /etc/apache/httpd.conf, or (on Debian and Ubuntu)
|
||||
/etc/apache2/sites-available/default. See the Apache documentation for
|
||||
.htaccess files for more details:
|
||||
|
||||
http://httpd.apache.org/docs/2.2/howto/htaccess.html
|
||||
|
||||
Also, check that mod_rewrite is installed and enabled:
|
||||
|
||||
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
|
||||
|
||||
Sphinx
|
||||
------
|
||||
|
||||
To use a Sphinx server to search users and notices, you'll need to
|
||||
enable the SphinxSearch plugin. Add to your config.php:
|
||||
|
||||
addPlugin('SphinxSearch');
|
||||
$config['sphinx']['server'] = 'searchhost.local';
|
||||
|
||||
You also need to install, compile and enable the sphinx pecl extension for
|
||||
php on the client side, which itself depends on the sphinx development files.
|
||||
|
||||
See plugins/SphinxSearch/README for more details and server setup.
|
||||
|
||||
SMS
|
||||
---
|
||||
|
||||
StatusNet supports a cheap-and-dirty system for sending update messages
|
||||
to mobile phones and for receiving updates from the mobile. Instead of
|
||||
sending through the SMS network itself, which is costly and requires
|
||||
buy-in from the wireless carriers, it simply piggybacks on the email
|
||||
gateways that many carriers provide to their customers. So, SMS
|
||||
configuration is essentially email configuration.
|
||||
|
||||
Each user sends to a made-up email address, which they keep a secret.
|
||||
Incoming email that is "From" the user's SMS email address, and "To"
|
||||
the users' secret email address on the site's domain, will be
|
||||
converted to a notice and stored in the DB.
|
||||
|
||||
For this to work, there *must* be a domain or sub-domain for which all
|
||||
(or most) incoming email can pass through the incoming mail filter.
|
||||
|
||||
1. Run the SQL script carrier.sql in your StatusNet database. This will
|
||||
usually work:
|
||||
|
||||
mysql -u "statusnetuser" --password="statusnetpassword" statusnet < db/carrier.sql
|
||||
|
||||
This will populate your database with a list of wireless carriers
|
||||
that support email SMS gateways.
|
||||
|
||||
2. Make sure the maildaemon.php file is executable:
|
||||
|
||||
chmod +x scripts/maildaemon.php
|
||||
|
||||
Note that "daemon" is kind of a misnomer here; the script is more
|
||||
of a filter than a daemon.
|
||||
|
||||
2. Edit /etc/aliases on your mail server and add the following line:
|
||||
|
||||
*: /path/to/statusnet/scripts/maildaemon.php
|
||||
|
||||
3. Run whatever code you need to to update your aliases database. For
|
||||
many mail servers (Postfix, Exim, Sendmail), this should work:
|
||||
|
||||
newaliases
|
||||
|
||||
You may need to restart your mail server for the new database to
|
||||
take effect.
|
||||
|
||||
4. Set the following in your config.php file:
|
||||
|
||||
$config['mail']['domain'] = 'yourdomain.example.net';
|
||||
|
||||
At this point, post-by-email and post-by-SMS-gateway should work. Note
|
||||
that if your mail server is on a different computer from your email
|
||||
server, you'll need to have a full installation of StatusNet, a working
|
||||
config.php, and access to the StatusNet database from the mail server.
|
||||
|
||||
XMPP
|
||||
----
|
||||
|
||||
XMPP (eXtended Message and Presence Protocol, <http://xmpp.org/>) is the
|
||||
instant-messenger protocol that drives Jabber and GTalk IM. You can
|
||||
distribute messages via XMPP using the system below; however, you
|
||||
need to run the XMPP incoming daemon to allow incoming messages as
|
||||
well.
|
||||
|
||||
1. You may want to strongly consider setting up your own XMPP server.
|
||||
Ejabberd, OpenFire, and JabberD are all Open Source servers.
|
||||
Jabber, Inc. provides a high-performance commercial server.
|
||||
|
||||
2. You must register a Jabber ID (JID) with your new server. It helps
|
||||
to choose a name like "update@example.com" or "notice" or something
|
||||
similar. Alternately, your "update JID" can be registered on a
|
||||
publicly-available XMPP service, like jabber.org or GTalk.
|
||||
|
||||
StatusNet will not register the JID with your chosen XMPP server;
|
||||
you need to do this manually, with an XMPP client like Gajim,
|
||||
Telepathy, or Pidgin.im.
|
||||
|
||||
3. Configure your site's XMPP variables, as described below in the
|
||||
configuration section.
|
||||
|
||||
On a default installation, your site can broadcast messages using
|
||||
XMPP. Users won't be able to post messages using XMPP unless you've
|
||||
got the XMPP daemon running. See 'Queues and daemons' below for how
|
||||
to set that up. Also, once you have a sizable number of users, sending
|
||||
a lot of SMS, OStatus, and XMPP messages whenever someone posts a message
|
||||
can really slow down your site; it may cause posting to timeout.
|
||||
|
||||
NOTE: stream_select(), a crucial function for network programming, is
|
||||
broken on PHP 5.2.x less than 5.2.6 on amd64-based servers. We don't
|
||||
work around this bug in StatusNet; current recommendation is to move
|
||||
off of amd64 to another server.
|
||||
|
||||
Public feed
|
||||
-----------
|
||||
|
||||
You can send *all* messages from your social networking site to a
|
||||
third-party service using XMPP. This can be useful for providing
|
||||
search, indexing, bridging, or other cool services.
|
||||
|
||||
To configure a downstream site to receive your public stream, add
|
||||
their "JID" (Jabber ID) to your config.php as follows:
|
||||
|
||||
$config['xmpp']['public'][] = 'downstream@example.net';
|
||||
|
||||
(Don't miss those square brackets at the end.) Note that your XMPP
|
||||
broadcasting must be configured as mentioned above. Although you can
|
||||
send out messages at "Web time", high-volume sites should strongly
|
||||
consider setting up queues and daemons.
|
||||
|
||||
Queues and daemons
|
||||
------------------
|
||||
|
||||
Some activities that StatusNet needs to do, like broadcast OStatus, SMS,
|
||||
and XMPP messages, can be 'queued' and done by off-line bots instead.
|
||||
For this to work, you must be able to run long-running offline
|
||||
processes, either on your main Web server or on another server you
|
||||
control. (Your other server will still need all the above
|
||||
prerequisites, with the exception of Apache.) Installing on a separate
|
||||
server is probably a good idea for high-volume sites.
|
||||
|
||||
1. You'll need the "CLI" (command-line interface) version of PHP
|
||||
installed on whatever server you use.
|
||||
|
||||
2. If you're using a separate server for queues, install StatusNet
|
||||
somewhere on the server. You don't need to worry about the
|
||||
.htaccess file, but make sure that your config.php file is close
|
||||
to, or identical to, your Web server's version.
|
||||
|
||||
3. In your config.php files (both the Web server and the queues
|
||||
server!), set the following variable:
|
||||
|
||||
$config['queue']['enabled'] = true;
|
||||
|
||||
You may also want to look at the 'daemon' section of this file for
|
||||
more daemon options. Note that if you set the 'user' and/or 'group'
|
||||
options, you'll need to create that user and/or group by hand.
|
||||
They're not created automatically.
|
||||
|
||||
4. On the queues server, run the command scripts/startdaemons.sh.
|
||||
|
||||
This will run the queue handlers:
|
||||
|
||||
* queuedaemon.php - polls for queued items for inbox processing and
|
||||
pushing out to OStatus, SMS, XMPP, etc.
|
||||
* xmppdaemon.php - listens for new XMPP messages from users and stores
|
||||
them as notices in the database; also pulls queued XMPP output from
|
||||
queuedaemon.php to push out to clients.
|
||||
|
||||
These two daemons will automatically restart in most cases of failure
|
||||
including memory leaks (if a memory_limit is set), but may still die
|
||||
or behave oddly if they lose connections to the XMPP or queue servers.
|
||||
|
||||
Additional daemons may be also started by this script for certain
|
||||
plugins, such as the Twitter bridge.
|
||||
|
||||
It may be a good idea to use a daemon-monitoring service, like 'monit',
|
||||
to check their status and keep them running.
|
||||
|
||||
All the daemons write their process IDs (pids) to /var/run/ by
|
||||
default. This can be useful for starting, stopping, and monitoring the
|
||||
daemons.
|
||||
|
||||
Since version 0.8.0, it's now possible to use a STOMP server instead of
|
||||
our kind of hacky home-grown DB-based queue solution. This is strongly
|
||||
recommended for best response time, especially when using XMPP.
|
||||
|
||||
See the "queues" config section below for how to configure to use STOMP.
|
||||
As of this writing, the software has been tested with ActiveMQ 5.3.
|
||||
|
||||
Themes
|
||||
------
|
||||
|
||||
Older themes (version 0.9.x and below) no longer work with StatusNet
|
||||
1.0.x, due to major changes in the site layout. We ship with three new
|
||||
themes for this version, 'neo', 'neo-blue' and 'neo-light'.
|
||||
|
||||
As of right now, your ability to change the theme is site-wide; users
|
||||
can't choose their own theme. Additionally, the only thing you can
|
||||
change in the theme is CSS stylesheets and some image files; you can't
|
||||
change the HTML output, like adding or removing menu items.
|
||||
|
||||
You can choose a theme using the $config['site']['theme'] element in
|
||||
the config.php file. See below for details.
|
||||
|
||||
You can add your own theme by making a sub-directory of the 'theme'
|
||||
subdirectory with the name of your theme. Each theme can have the
|
||||
following files:
|
||||
|
||||
display.css: a CSS2 file for "default" styling for all browsers.
|
||||
ie6.css: a CSS2 file for override styling for fixing up Internet
|
||||
Explorer 6.
|
||||
ie7.css: a CSS2 file for override styling for fixing up Internet
|
||||
Explorer 7.
|
||||
logo.png: a logo image for the site.
|
||||
default-avatar-profile.png: a 96x96 pixel image to use as the avatar for
|
||||
users who don't upload their own.
|
||||
default-avatar-stream.png: Ditto, but 48x48. For streams of notices.
|
||||
default-avatar-mini.png: Ditto ditto, but 24x24. For subscriptions
|
||||
listing on profile pages.
|
||||
|
||||
You may want to start by copying the files from the default theme to
|
||||
your own directory.
|
||||
|
||||
Translation
|
||||
-----------
|
||||
|
||||
Translations in StatusNet use the gettext system <http://www.gnu.org/software/gettext/>.
|
||||
Theoretically, you can add your own sub-directory to the locale/
|
||||
subdirectory to add a new language to your system. You'll need to
|
||||
compile the ".po" files into ".mo" files, however.
|
||||
|
||||
Contributions of translation information to StatusNet are very easy:
|
||||
you can use the Web interface at translatewiki.net to add one
|
||||
or a few or lots of new translations -- or even new languages. You can
|
||||
also download more up-to-date .po files there, if you so desire.
|
||||
|
||||
For info on helping with translations, see http://status.net/wiki/Translations
|
||||
|
||||
Backups
|
||||
-------
|
||||
|
||||
There is no built-in system for doing backups in StatusNet. You can make
|
||||
backups of a working StatusNet system by backing up the database and
|
||||
the Web directory. To backup the database use mysqldump <http://ur1.ca/7xo>
|
||||
and to backup the Web directory, try tar.
|
||||
|
||||
Private
|
||||
-------
|
||||
|
||||
The administrator can set the "private" flag for a site so that it's
|
||||
not visible to non-logged-in users. (This is the default for new installs of version 1.0!)
|
||||
|
||||
This might be useful for workgroups who want to share a social
|
||||
networking site for project management, but host it on a public
|
||||
server.
|
||||
|
||||
Total privacy is attempted but not guaranteed or ensured. Private sites
|
||||
currently don't work well with OStatus federation.
|
||||
|
||||
Access to file attachments can also be restricted to logged-in users only.
|
||||
|
||||
1. Add a directory outside the web root where your file uploads will be
|
||||
stored. Usually a command like this will work:
|
||||
|
||||
mkdir /var/www/statusnet-files
|
||||
|
||||
2. Make the file uploads directory writeable by the web server. An
|
||||
insecure way to do this is:
|
||||
|
||||
chmod a+x /var/www/statusnet-files
|
||||
|
||||
3. Tell StatusNet to use this directory for file uploads. Add a line
|
||||
like this to your config.php:
|
||||
|
||||
$config['attachments']['dir'] = '/var/www/statusnet-files';
|
44
PLUGINS.txt
Normal file
44
PLUGINS.txt
Normal file
|
@ -0,0 +1,44 @@
|
|||
Plugins
|
||||
=======
|
||||
|
||||
Beginning with the 0.7.x branch, StatusNet has supported a simple but
|
||||
powerful plugin architecture. Important events in the code are named,
|
||||
like 'StartNoticeSave', and other software can register interest
|
||||
in those events. When the events happen, the other software is called
|
||||
and has a choice of accepting or rejecting the events.
|
||||
|
||||
In the simplest case, you can add a function to config.php and use the
|
||||
Event::addHandler() function to hook an event:
|
||||
|
||||
function AddGoogleLink($action)
|
||||
{
|
||||
$action->menuItem('http://www.google.com/', _('Google'), _('Search engine'));
|
||||
return true;
|
||||
}
|
||||
|
||||
Event::addHandler('EndPrimaryNav', 'AddGoogleLink');
|
||||
|
||||
This adds a menu item to the end of the main navigation menu. You can
|
||||
see the list of existing events, and parameters that handlers must
|
||||
implement, in EVENTS.txt.
|
||||
|
||||
The Plugin class in lib/plugin.php makes it easier to write more
|
||||
complex plugins. Sub-classes can just create methods named
|
||||
'onEventName', where 'EventName' is the name of the event (case
|
||||
matters!). These methods will be automatically registered as event
|
||||
handlers by the Plugin constructor (which you must call from your own
|
||||
class's constructor).
|
||||
|
||||
Several example plugins are included in the plugins/ directory. You
|
||||
can enable a plugin with the following line in config.php:
|
||||
|
||||
addPlugin('Example', array('param1' => 'value1',
|
||||
'param2' => 'value2'));
|
||||
|
||||
This will look for and load files named 'ExamplePlugin.php' or
|
||||
'Example/ExamplePlugin.php' either in the plugins/ directory (for
|
||||
plugins that ship with StatusNet) or in the local/ directory (for
|
||||
plugins you write yourself or that you get from somewhere else) or
|
||||
local/plugins/.
|
||||
|
||||
Plugins are documented in their own directories.
|
117
UPGRADE
Normal file
117
UPGRADE
Normal file
|
@ -0,0 +1,117 @@
|
|||
Upgrading
|
||||
=========
|
||||
|
||||
If you've been using StatusNet 1.0 or lower, or if you've
|
||||
been tracking the "git" version of the software, you will probably
|
||||
want to upgrade and keep your existing data. Try these step-by-step
|
||||
instructions; read to the end first before trying them.
|
||||
|
||||
0. Download StatusNet and set up all the prerequisites as if you were
|
||||
doing a new install.
|
||||
1. Make backups of both your database and your Web directory. UNDER NO
|
||||
CIRCUMSTANCES should you try to do an upgrade without a known-good
|
||||
backup. You have been warned.
|
||||
2. Shut down Web access to your site, either by turning off your Web
|
||||
server or by redirecting all pages to a "sorry, under maintenance"
|
||||
page.
|
||||
3. Shut down XMPP access to your site, typically by shutting down the
|
||||
xmppdaemon.php process and all other daemons that you're running.
|
||||
If you've got "monit" or "cron" automatically restarting your
|
||||
daemons, make sure to turn that off, too.
|
||||
4. Shut down SMS and email access to your site. The easy way to do
|
||||
this is to comment out the line piping incoming email to your
|
||||
maildaemon.php file, and running something like "newaliases".
|
||||
5. Once all writing processes to your site are turned off, make a
|
||||
final backup of the Web directory and database.
|
||||
6. Move your StatusNet directory to a backup spot, like "statusnet.bak".
|
||||
7. Unpack your StatusNet 1.1.1 tarball and move it to "statusnet" or
|
||||
wherever your code used to be.
|
||||
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. Upgrade the database.
|
||||
|
||||
NOTE: this step is destructive and cannot be
|
||||
reversed. YOU CAN EASILY DESTROY YOUR SITE WITH THIS STEP. Don't
|
||||
do it without a known-good backup!
|
||||
|
||||
In your new StatusNet 1.1.1 directory and AFTER YOU MAKE A
|
||||
BACKUP run the upgrade.php script like this:
|
||||
|
||||
php ./scripts/upgrade.php
|
||||
|
||||
11. Use mysql or psql client to log into your database and make sure that
|
||||
the notice, user, profile, subscription etc. tables are non-empty.
|
||||
12. Turn back on the Web server, and check that things still work.
|
||||
13. Turn back on XMPP bots and email maildaemon.
|
||||
|
||||
NOTE: the 1.0.0 version of StatusNet changed the URLs for all admin
|
||||
panels from /admin/* to /panel/*. This now allows the (popular)
|
||||
username 'admin', but blocks the considerably less popular username
|
||||
'panel'. If you have an existing user named 'panel', you should rename
|
||||
them before upgrading.
|
||||
|
||||
UTF-8 Database
|
||||
--------------
|
||||
|
||||
If you are upgrading from a 0.8.x or 0.9.x version, you can safely
|
||||
skip this section.
|
||||
|
||||
StatusNet 0.7.4 introduced a fix for some incorrectly-stored
|
||||
international characters ("UTF-8"). This fix is not
|
||||
backwards-compatible; installations from before 0.7.4 will show
|
||||
non-ASCII characters of old notices incorrectly. This section explains
|
||||
what to do.
|
||||
|
||||
0. You can disable the new behaviour by setting the 'db''utf8' config
|
||||
option to "false". You should only do this until you're ready to
|
||||
convert your DB to the new format.
|
||||
1. When you're ready to convert, you can run the fixup_utf8.php script
|
||||
in the scripts/ subdirectory. If you've had the "new behaviour"
|
||||
enabled (probably a good idea), you can give the ID of the first
|
||||
"new" notice as a parameter, and only notices before that one will
|
||||
be converted. Notices are converted in reverse chronological order,
|
||||
so the most recent (and visible) ones will be converted first. The
|
||||
script should work whether or not you have the 'db''utf8' config
|
||||
option enabled.
|
||||
2. When you're ready, set $config['db']['utf8'] to true, so that
|
||||
new notices will be stored correctly.
|
||||
|
||||
Older versions
|
||||
==============
|
||||
|
||||
IMPORTANT NOTE: StatusNet 0.7.4 introduced a fix for some
|
||||
incorrectly-stored international characters ("UTF-8"). For new
|
||||
installations, it will now store non-ASCII characters correctly.
|
||||
However, older installations will have the incorrect storage, and will
|
||||
consequently show up "wrong" in browsers. See below for how to deal
|
||||
with this situation.
|
||||
|
||||
NOTE: the database definition file, laconica.ini, has been renamed to
|
||||
statusnet.ini (since this is the recommended database name). If you
|
||||
have a line in your config.php pointing to the old name, you'll need
|
||||
to update it.
|
||||
|
||||
Note that the XMPP bots have changed since version 0.5; see above for
|
||||
details.
|
||||
|
||||
Privacy
|
||||
=======
|
||||
|
||||
With StatusNet 1.0, our default install profile is for private sites.
|
||||
|
||||
If you did not specify the privacy level of your site previously, it
|
||||
was public. Now, it's private.
|
||||
|
||||
If you upgrade a public site, you will need to reset the privacy
|
||||
level. You can do this in your config.php:
|
||||
|
||||
$config['site']['private'] = false;
|
||||
|
||||
...or with setconfig.php in the db:
|
||||
|
||||
php setconfig.php site private false
|
||||
|
||||
...or with the site admin panel.
|
|
@ -187,9 +187,9 @@ class AccessAdminPanelForm extends AdminForm
|
|||
*/
|
||||
function formActions()
|
||||
{
|
||||
// TRANS: Title for button to save access settings in site admin panel.
|
||||
$title = _('Save access settings');
|
||||
// TRANS: Tooltip for button to save access settings in site admin panel.
|
||||
// TRANS: Button title to save access settings in site admin panel.
|
||||
$title = _('Save access settings.');
|
||||
// TRANS: Button text to save access settings in site admin panel.
|
||||
$this->out->submit('submit', _m('BUTTON', 'Save'), 'submit', null, $title);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,18 +111,6 @@ class AddpeopletagAction extends Action
|
|||
return false;
|
||||
}
|
||||
|
||||
// OMB 0.1 doesn't have a mechanism for local-server-
|
||||
// originated tag.
|
||||
|
||||
$omb01 = Remote_profile::staticGet('id', $tagged_id);
|
||||
|
||||
if (!empty($omb01)) {
|
||||
// TRANS: Client error displayed when trying to add an OMB 0.1 remote profile to a list.
|
||||
$this->clientError(_('You cannot list an OMB 0.1 '.
|
||||
'remote profile with this action.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2008, 2009, StatusNet, Inc.
|
||||
* Copyright (C) 2008-2011, 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
|
||||
|
@ -56,7 +56,13 @@ class AllAction extends ProfileAction
|
|||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
if (!empty($user) && $user->streamModeOnly()) {
|
||||
$stream = new InboxNoticeStream($this->user, Profile::current());
|
||||
} else {
|
||||
$stream = new ThreadingInboxNoticeStream($this->user, Profile::current());
|
||||
}
|
||||
|
||||
$this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||
NOTICES_PER_PAGE + 1);
|
||||
|
@ -85,7 +91,7 @@ class AllAction extends ProfileAction
|
|||
function title()
|
||||
{
|
||||
$user = common_current_user();
|
||||
if ($user->id == $this->user->id) {
|
||||
if (!empty($user) && $user->id == $this->user->id) {
|
||||
// TRANS: Title of a user's own start page.
|
||||
return _('Home timeline');
|
||||
} else {
|
||||
|
@ -99,6 +105,15 @@ class AllAction extends ProfileAction
|
|||
function getFeeds()
|
||||
{
|
||||
return array(
|
||||
new Feed(Feed::JSON,
|
||||
common_local_url(
|
||||
'ApiTimelineFriends', array(
|
||||
'format' => 'as',
|
||||
'id' => $this->user->nickname
|
||||
)
|
||||
),
|
||||
// TRANS: %s is user nickname.
|
||||
sprintf(_('Feed for friends of %s (Activity Streams JSON)'), $this->user->nickname)),
|
||||
new Feed(Feed::RSS1,
|
||||
common_local_url(
|
||||
'allrss', array(
|
||||
|
@ -145,7 +160,7 @@ class AllAction extends ProfileAction
|
|||
$message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from their profile or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
|
||||
}
|
||||
} else {
|
||||
// TRANS: Encoutagement displayed on empty timeline user pages for anonymous users.
|
||||
// TRANS: Encouragement displayed on empty timeline user pages for anonymous users.
|
||||
// TRANS: %s is a user nickname. This message contains Markdown links. Keep "](" together.
|
||||
$message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->user->nickname);
|
||||
}
|
||||
|
@ -167,7 +182,11 @@ class AllAction extends ProfileAction
|
|||
$profile = $current_user->getProfile();
|
||||
}
|
||||
|
||||
if (!empty($current_user) && $current_user->streamModeOnly()) {
|
||||
$nl = new NoticeList($this->notice, $this);
|
||||
} else {
|
||||
$nl = new ThreadedNoticeList($this->notice, $this, $profile);
|
||||
}
|
||||
|
||||
$cnt = $nl->show();
|
||||
|
||||
|
@ -186,12 +205,29 @@ class AllAction extends ProfileAction
|
|||
|
||||
function showSections()
|
||||
{
|
||||
// Show invite button, as long as site isn't closed, and
|
||||
// we have a logged in user.
|
||||
if (common_config('invite', 'enabled') && !common_config('site', 'closed') && common_logged_in()) {
|
||||
if (!common_config('site', 'private')) {
|
||||
$ibs = new InviteButtonSection(
|
||||
$this,
|
||||
// TRANS: Button text for inviting more users to the StatusNet instance.
|
||||
// TRANS: Less business/enterprise-oriented language for public sites.
|
||||
_m('BUTTON', 'Send invite')
|
||||
);
|
||||
} else {
|
||||
$ibs = new InviteButtonSection($this);
|
||||
}
|
||||
$ibs->show();
|
||||
$pop = new PopularNoticeSection($this);
|
||||
}
|
||||
// XXX: make this a little more convenient
|
||||
|
||||
if (!common_config('performance', 'high')) {
|
||||
$pop = new PopularNoticeSection($this, Profile::current());
|
||||
$pop->show();
|
||||
// $pop = new InboxTagCloudSection($this, $this->user);
|
||||
// $pop->show();
|
||||
$pop = new InboxTagCloudSection($this, $this->user);
|
||||
$pop->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,215 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Update the authenticating user's profile background image
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: 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/>.
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
|
||||
/**
|
||||
* Update the authenticating user's profile background image
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction
|
||||
{
|
||||
var $tile = false;
|
||||
|
||||
/**
|
||||
* Take arguments for running
|
||||
*
|
||||
* @param array $args $_REQUEST args
|
||||
*
|
||||
* @return boolean success flag
|
||||
*
|
||||
*/
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->user = $this->auth_user;
|
||||
$this->tile = $this->arg('tile');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the request
|
||||
*
|
||||
* Check whether the credentials are valid and output the result
|
||||
*
|
||||
* @param array $args $_REQUEST data (unused)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
$this->clientError(
|
||||
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||
_('This method requires a POST.'),
|
||||
400, $this->format
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array($this->format, array('xml', 'json'))) {
|
||||
$this->clientError(
|
||||
// TRANS: Client error displayed when coming across a non-supported API method.
|
||||
_('API method not found.'),
|
||||
404,
|
||||
$this->format
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround for PHP returning empty $_POST and $_FILES when POST
|
||||
// length > post_max_size in php.ini
|
||||
|
||||
if (empty($_FILES)
|
||||
&& empty($_POST)
|
||||
&& ($_SERVER['CONTENT_LENGTH'] > 0)
|
||||
) {
|
||||
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
|
||||
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
|
||||
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
|
||||
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
|
||||
intval($_SERVER['CONTENT_LENGTH']));
|
||||
|
||||
$this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($this->user)) {
|
||||
// TRANS: Client error when user not found updating a profile background image.
|
||||
$this->clientError(_('No such user.'), 404, $this->format);
|
||||
return;
|
||||
}
|
||||
|
||||
$design = $this->user->getDesign();
|
||||
|
||||
// XXX: This is kinda gross, but before we can add a background
|
||||
// img we have to make sure there's a Design because design ID
|
||||
// is part of the img filename.
|
||||
|
||||
if (empty($design)) {
|
||||
$this->user->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
$design = new Design();
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Client error displayed when saving design settings fails because of an empty id.
|
||||
$this->clientError(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($this->user);
|
||||
$this->user->design_id = $id;
|
||||
$result = $this->user->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Client error displayed when saving design settings fails because of an empty result.
|
||||
$this->clientError(_('Unable to save your design settings.'));
|
||||
$this->user->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->user->query('COMMIT');
|
||||
}
|
||||
|
||||
// Okay, now get the image and add it to the design
|
||||
|
||||
try {
|
||||
$imagefile = ImageFile::fromUpload('image');
|
||||
} catch (Exception $e) {
|
||||
$this->clientError($e->getMessage(), 400, $this->format);
|
||||
return;
|
||||
}
|
||||
|
||||
$filename = Design::filename(
|
||||
$design->id,
|
||||
image_type_to_extension($imagefile->type),
|
||||
common_timestamp()
|
||||
);
|
||||
|
||||
$filepath = Design::path($filename);
|
||||
|
||||
move_uploaded_file($imagefile->filepath, $filepath);
|
||||
|
||||
// delete any old backround img laying around
|
||||
|
||||
if (isset($design->backgroundimage)) {
|
||||
@unlink(Design::path($design->backgroundimage));
|
||||
}
|
||||
|
||||
$original = clone($design);
|
||||
$design->backgroundimage = $filename;
|
||||
$design->setDisposition(true, false, ($this->tile == 'true'));
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
// TRANS: Error displayed when updating design settings fails.
|
||||
$this->showForm(_('Could not update your design.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$profile = $this->user->getProfile();
|
||||
|
||||
if (empty($profile)) {
|
||||
// TRANS: Error message displayed when referring to a user without a profile.
|
||||
$this->clientError(_('User has no profile.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$twitter_user = $this->twitterUserArray($profile, true);
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->initDocument('xml');
|
||||
$this->showTwitterXmlUser($twitter_user, 'user', true);
|
||||
$this->endDocument('xml');
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->initDocument('json');
|
||||
$this->showJsonObjects($twitter_user);
|
||||
$this->endDocument('json');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,242 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Update a user's design colors
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: 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/>.
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009-2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
|
||||
/**
|
||||
* Sets one or more hex values that control the color scheme of the
|
||||
* authenticating user's design
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||
{
|
||||
var $profile_background_color = null;
|
||||
var $profile_text_color = null;
|
||||
var $profile_link_color = null;
|
||||
var $profile_sidebar_fill_color = null;
|
||||
var $profile_sidebar_border_color = null;
|
||||
|
||||
/**
|
||||
* Take arguments for running
|
||||
*
|
||||
* @param array $args $_REQUEST args
|
||||
*
|
||||
* @return boolean success flag
|
||||
*/
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->user = $this->auth_user;
|
||||
|
||||
$this->profile_background_color
|
||||
= $this->trimmed('profile_background_color');
|
||||
$this->profile_text_color
|
||||
= $this->trimmed('profile_text_color');
|
||||
$this->profile_link_color
|
||||
= $this->trimmed('profile_link_color');
|
||||
$this->profile_sidebar_fill_color
|
||||
= $this->trimmed('profile_sidebar_fill_color');
|
||||
|
||||
// XXX: we don't support changing the sidebar border color
|
||||
// in our designs.
|
||||
|
||||
$this->profile_sidebar_border_color
|
||||
= $this->trimmed('profile_sidebar_border_color');
|
||||
|
||||
// XXX: Unlike Twitter, we do allow people to change the 'content color'
|
||||
|
||||
$this->profile_content_color = $this->trimmed('profile_content_color');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the request
|
||||
*
|
||||
* Try to save the user's colors in her design. Create a new design
|
||||
* if the user doesn't already have one.
|
||||
*
|
||||
* @param array $args $_REQUEST data (unused)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
$this->clientError(
|
||||
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||
_('This method requires a POST.'),
|
||||
400, $this->format
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array($this->format, array('xml', 'json'))) {
|
||||
$this->clientError(
|
||||
// TRANS: Client error displayed when coming across a non-supported API method.
|
||||
_('API method not found.'),
|
||||
404,
|
||||
$this->format
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$design = $this->user->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
$original = clone($design);
|
||||
|
||||
try {
|
||||
$this->setColors($design);
|
||||
} catch (WebColorException $e) {
|
||||
$this->clientError($e->getMessage(), 400, $this->format);
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
// TRANS: Client error displayed when a database error occurs updating profile colours.
|
||||
$this->clientError(_('Could not update your design.'));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$this->user->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
$design = new Design();
|
||||
|
||||
try {
|
||||
$this->setColors($design);
|
||||
} catch (WebColorException $e) {
|
||||
$this->clientError($e->getMessage(), 400, $this->format);
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Client error displayed when a database error occurs inserting profile colours.
|
||||
$this->clientError(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($this->user);
|
||||
$this->user->design_id = $id;
|
||||
$result = $this->user->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Client error displayed when a database error occurs updating profile colours.
|
||||
$this->clientError(_('Unable to save your design settings.'));
|
||||
$this->user->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->user->query('COMMIT');
|
||||
}
|
||||
|
||||
$profile = $this->user->getProfile();
|
||||
|
||||
if (empty($profile)) {
|
||||
// TRANS: Error message displayed when referring to a user without a profile.
|
||||
$this->clientError(_('User has no profile.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$twitter_user = $this->twitterUserArray($profile, true);
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->initDocument('xml');
|
||||
$this->showTwitterXmlUser($twitter_user, 'user', true);
|
||||
$this->endDocument('xml');
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->initDocument('json');
|
||||
$this->showJsonObjects($twitter_user);
|
||||
$this->endDocument('json');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user's design colors based on the request parameters
|
||||
*
|
||||
* @param Design $design the user's Design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setColors($design)
|
||||
{
|
||||
$bgcolor = empty($this->profile_background_color) ?
|
||||
null : new WebColor($this->profile_background_color);
|
||||
$tcolor = empty($this->profile_text_color) ?
|
||||
null : new WebColor($this->profile_text_color);
|
||||
$sbcolor = empty($this->profile_sidebar_fill_color) ?
|
||||
null : new WebColor($this->profile_sidebar_fill_color);
|
||||
$lcolor = empty($this->profile_link_color) ?
|
||||
null : new WebColor($this->profile_link_color);
|
||||
$ccolor = empty($this->profile_content_color) ?
|
||||
null : new WebColor($this->profile_content_color);
|
||||
|
||||
if (!empty($bgcolor)) {
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
}
|
||||
|
||||
if (!empty($ccolor)) {
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
}
|
||||
|
||||
if (!empty($sbcolor)) {
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
}
|
||||
|
||||
if (!empty($tcolor)) {
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
}
|
||||
|
||||
if (!empty($lcolor)) {
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
238
actions/apiconversation.php
Normal file
238
actions/apiconversation.php
Normal file
|
@ -0,0 +1,238 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2011, StatusNet, Inc.
|
||||
*
|
||||
* Show a stream of notices in a particular conversation
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
|
||||
/**
|
||||
* Show a stream of notices in a particular conversation
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ApiconversationAction extends ApiAuthAction
|
||||
{
|
||||
protected $conversation = null;
|
||||
protected $notices = null;
|
||||
|
||||
/**
|
||||
* For initializing members of the class.
|
||||
*
|
||||
* @param array $argarray misc. arguments
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
|
||||
$convId = $this->trimmed('id');
|
||||
|
||||
if (empty($convId)) {
|
||||
// TRANS: Client exception thrown when no conversation ID is given.
|
||||
throw new ClientException(_('No conversation ID.'));
|
||||
}
|
||||
|
||||
$this->conversation = Conversation::staticGet('id', $convId);
|
||||
|
||||
if (empty($this->conversation)) {
|
||||
// TRANS: Client exception thrown when referring to a non-existing conversation ID (%d).
|
||||
throw new ClientException(sprintf(_('No conversation with ID %d.'), $convId),
|
||||
404);
|
||||
}
|
||||
|
||||
$profile = Profile::current();
|
||||
|
||||
$stream = new ConversationNoticeStream($convId, $profile);
|
||||
|
||||
$notice = $stream->getNotices(($this->page-1) * $this->count,
|
||||
$this->count,
|
||||
$this->since_id,
|
||||
$this->max_id);
|
||||
|
||||
$this->notices = $notice->fetchAll();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler method
|
||||
*
|
||||
* @param array $argarray is ignored since it's now passed in in prepare()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle($argarray=null)
|
||||
{
|
||||
$sitename = common_config('site', 'name');
|
||||
// TRANS: Title for conversion timeline.
|
||||
$title = _m('TITLE', 'Conversation');
|
||||
$id = common_local_url('apiconversation', array('id' => $this->conversation->id, 'format' => $this->format));
|
||||
$link = common_local_url('conversation', array('id' => $this->conversation->id));
|
||||
|
||||
$self = $id;
|
||||
|
||||
switch($this->format) {
|
||||
case 'xml':
|
||||
$this->showXmlTimeline($this->notices);
|
||||
break;
|
||||
case 'rss':
|
||||
$this->showRssTimeline(
|
||||
$this->notices,
|
||||
$title,
|
||||
$link,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$self
|
||||
);
|
||||
break;
|
||||
case 'atom':
|
||||
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
$atom->setUpdated('now');
|
||||
|
||||
$atom->addLink($link);
|
||||
$atom->setSelfLink($self);
|
||||
|
||||
$atom->addEntryFromNotices($this->notices);
|
||||
$this->raw($atom->getString());
|
||||
|
||||
break;
|
||||
case 'json':
|
||||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when coming across a non-supported API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if read only.
|
||||
*
|
||||
* MAY override
|
||||
*
|
||||
* @param array $args other arguments
|
||||
*
|
||||
* @return boolean is read only action?
|
||||
*/
|
||||
function isReadOnly($args)
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return last modified, if applicable.
|
||||
*
|
||||
* MAY override
|
||||
*
|
||||
* @return string last modified http header
|
||||
*/
|
||||
function lastModified()
|
||||
{
|
||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||
return strtotime($this->notices[0]->created);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return etag, if applicable.
|
||||
*
|
||||
* MAY override
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
function etag()
|
||||
{
|
||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||
|
||||
$last = count($this->notices) - 1;
|
||||
|
||||
return '"' . implode(
|
||||
':',
|
||||
array($this->arg('action'),
|
||||
common_user_cache_hash($this->auth_user),
|
||||
common_language(),
|
||||
$this->user->id,
|
||||
strtotime($this->notices[0]->created),
|
||||
strtotime($this->notices[$last]->created))
|
||||
)
|
||||
. '"';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this require authentication?
|
||||
*
|
||||
* @return boolean true if delete, else false
|
||||
*/
|
||||
function requiresAuth()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -65,6 +65,12 @@ class ApiFavoriteCreateAction extends ApiAuthAction
|
|||
|
||||
$this->user = $this->auth_user;
|
||||
$this->notice = Notice::staticGet($this->arg('id'));
|
||||
if ($this->notice->repeat_of != '' ) {
|
||||
common_log(LOG_DEBUG, 'Trying to Fave '.$this->notice->id.', repeat of '.$this->notice->repeat_of);
|
||||
common_log(LOG_DEBUG, 'Will Fave '.$this->notice->repeat_of.' instead');
|
||||
$real_notice_id = $this->notice->repeat_of;
|
||||
$this->notice = Notice::staticGet($real_notice_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,12 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
|
|||
|
||||
$this->user = $this->auth_user;
|
||||
$this->notice = Notice::staticGet($this->arg('id'));
|
||||
if ($this->notice->repeat_of != '' ) {
|
||||
common_log(LOG_DEBUG, 'Trying to unFave '.$this->notice->id);
|
||||
common_log(LOG_DEBUG, 'Will unFave '.$this->notice->repeat_of.' instead');
|
||||
$real_notice_id = $this->notice->repeat_of;
|
||||
$this->notice = Notice::staticGet($real_notice_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @copyright 2010-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ require_once INSTALLDIR . '/lib/apioauth.php';
|
|||
require_once INSTALLDIR . '/lib/info.php';
|
||||
|
||||
/**
|
||||
* Authorize an Oputh request token
|
||||
* Authorize an OAuth request token
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
|
@ -196,12 +196,6 @@ class ApiOauthAuthorizeAction extends Action
|
|||
)
|
||||
);
|
||||
|
||||
// XXX: Make sure we have a oauth_token_association table. The table
|
||||
// is now in the main schema, but because it is being added with
|
||||
// a point release, it's unlikely to be there. This code can be
|
||||
// removed as of 1.0.
|
||||
$this->ensureOauthTokenAssociationTable();
|
||||
|
||||
$tokenAssoc = new Oauth_token_association();
|
||||
|
||||
$tokenAssoc->profile_id = $user->id;
|
||||
|
@ -295,30 +289,6 @@ class ApiOauthAuthorizeAction extends Action
|
|||
}
|
||||
}
|
||||
|
||||
// XXX Remove this function when we hit 1.0
|
||||
function ensureOauthTokenAssociationTable()
|
||||
{
|
||||
$schema = Schema::get();
|
||||
|
||||
$reqTokenCols = array(
|
||||
new ColumnDef('profile_id', 'integer', null, true, 'PRI'),
|
||||
new ColumnDef('application_id', 'integer', null, true, 'PRI'),
|
||||
new ColumnDef('token', 'varchar', 255, true, 'PRI'),
|
||||
new ColumnDef('created', 'datetime', null, false),
|
||||
new ColumnDef(
|
||||
'modified',
|
||||
'timestamp',
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
'CURRENT_TIMESTAMP',
|
||||
'on update CURRENT_TIMESTAMP'
|
||||
)
|
||||
);
|
||||
|
||||
$schema->ensureTable('oauth_token_association', $reqTokenCols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show body - override to add a special CSS class for the authorize
|
||||
* page's "desktop mode" (minimal display)
|
||||
|
|
|
@ -92,8 +92,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
|||
*/
|
||||
function prepare($args)
|
||||
{
|
||||
common_debug("in apisearchatom prepare()");
|
||||
|
||||
parent::prepare($args);
|
||||
|
||||
$this->query = $this->trimmed('q');
|
||||
|
|
|
@ -63,8 +63,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
|
|||
*/
|
||||
function prepare($args)
|
||||
{
|
||||
common_debug("apisearchjson prepare()");
|
||||
|
||||
parent::prepare($args);
|
||||
|
||||
$this->query = $this->trimmed('q');
|
||||
|
@ -91,6 +89,12 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
|
|||
$this->since_id = $this->trimmed('since_id');
|
||||
$this->geocode = $this->trimmed('geocode');
|
||||
|
||||
if (!empty($this->auth_user)) {
|
||||
$this->auth_profile = $this->auth_user->getProfile();
|
||||
} else {
|
||||
$this->auth_profile = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -114,20 +118,27 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
|
|||
*/
|
||||
function showResults()
|
||||
{
|
||||
// TODO: Support search operators like from: and to:, boolean, etc.
|
||||
|
||||
$notice = new Notice();
|
||||
|
||||
// lcase it for comparison
|
||||
$q = strtolower($this->query);
|
||||
|
||||
$search_engine = $notice->getSearchEngine('notice');
|
||||
$search_engine->set_sort_mode('chron');
|
||||
$search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true);
|
||||
if (false === $search_engine->query($q)) {
|
||||
$cnt = 0;
|
||||
// TODO: Support search operators like from: and to:, boolean, etc.
|
||||
|
||||
if (preg_match('/^#([\pL\pN_\-\.]{1,64})$/ue', $q)) {
|
||||
$stream = new TagNoticeStream(substr($q, 1), $this->auth_profile);
|
||||
} else if ($this->isAnURL($q)) {
|
||||
$canon = File_redirection::_canonUrl($q);
|
||||
$file = File::staticGet('url', $canon);
|
||||
if (!empty($file)) {
|
||||
$stream = new FileNoticeStream($file, $this->auth_profile);
|
||||
}
|
||||
} else {
|
||||
$cnt = $notice->find();
|
||||
$stream = new SearchNoticeStream($q, $this->auth_profile);
|
||||
}
|
||||
|
||||
if (empty($stream)) {
|
||||
// XXX: This is hackish, but need some simple way to say "There's no results"
|
||||
$notice = new ArrayWrapper(array());
|
||||
} else {
|
||||
$notice = $stream->getNotices(($this->page - 1) * $this->rpp, $this->rpp + 1);
|
||||
}
|
||||
|
||||
// TODO: max_id, lang, geocode
|
||||
|
@ -139,6 +150,47 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
|
|||
$this->endDocument('json');
|
||||
}
|
||||
|
||||
function isAnURL($q) {
|
||||
$regex = '#^'.
|
||||
'(?:^|[\s\<\>\(\)\[\]\{\}\\\'\\\";]+)(?![\@\!\#])'.
|
||||
'('.
|
||||
'(?:'.
|
||||
'(?:'. //Known protocols
|
||||
'(?:'.
|
||||
'(?:(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|irc)://)'.
|
||||
'|'.
|
||||
'(?:(?:mailto|aim|tel|xmpp):)'.
|
||||
')'.
|
||||
'(?:[\pN\pL\-\_\+\%\~]+(?::[\pN\pL\-\_\+\%\~]+)?\@)?'. //user:pass@
|
||||
'(?:'.
|
||||
'(?:'.
|
||||
'\[[\pN\pL\-\_\:\.]+(?<![\.\:])\]'. //[dns]
|
||||
')|(?:'.
|
||||
'[\pN\pL\-\_\:\.]+(?<![\.\:])'. //dns
|
||||
')'.
|
||||
')'.
|
||||
')'.
|
||||
'|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'. //IPv4
|
||||
'|(?:'. //IPv6
|
||||
'\[?(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}(?:(?:[0-9A-Fa-f]{1,4})|:))|(?:(?:[0-9A-Fa-f]{1,4}:){6}(?::|(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(?::[0-9A-Fa-f]{1,4})))|(?:(?:[0-9A-Fa-f]{1,4}:){5}(?:(?::(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|(?:(?::[0-9A-Fa-f]{1,4}){1,2})))|(?:(?:[0-9A-Fa-f]{1,4}:){4}(?::[0-9A-Fa-f]{1,4}){0,1}(?:(?::(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|(?:(?::[0-9A-Fa-f]{1,4}){1,2})))|(?:(?:[0-9A-Fa-f]{1,4}:){3}(?::[0-9A-Fa-f]{1,4}){0,2}(?:(?::(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|(?:(?::[0-9A-Fa-f]{1,4}){1,2})))|(?:(?:[0-9A-Fa-f]{1,4}:){2}(?::[0-9A-Fa-f]{1,4}){0,3}(?:(?::(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|(?:(?::[0-9A-Fa-f]{1,4}){1,2})))|(?:(?:[0-9A-Fa-f]{1,4}:)(?::[0-9A-Fa-f]{1,4}){0,4}(?:(?::(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|(?:(?::[0-9A-Fa-f]{1,4}){1,2})))|(?::(?::[0-9A-Fa-f]{1,4}){0,5}(?:(?::(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|(?:(?::[0-9A-Fa-f]{1,4}){1,2})))|(?:(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))\]?(?<!:)'.
|
||||
')|(?:'. //DNS
|
||||
'(?:[\pN\pL\-\_\+\%\~]+(?:\:[\pN\pL\-\_\+\%\~]+)?\@)?'. //user:pass@
|
||||
'[\pN\pL\-\_]+(?:\.[\pN\pL\-\_]+)*\.'.
|
||||
//tld list from http://data.iana.org/TLD/tlds-alpha-by-domain.txt, also added local, loc, and onion
|
||||
'(?:AC|AD|AE|AERO|AF|AG|AI|AL|AM|AN|AO|AQ|AR|ARPA|AS|ASIA|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BIZ|BJ|BM|BN|BO|BR|BS|BT|BV|BW|BY|BZ|CA|CAT|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|COM|COOP|CR|CU|CV|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EDU|EE|EG|ER|ES|ET|EU|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GOV|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|INFO|INT|IO|IQ|IR|IS|IT|JE|JM|JO|JOBS|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MG|MH|MIL|MK|ML|MM|MN|MO|MOBI|MP|MQ|MR|MS|MT|MU|MUSEUM|MV|MW|MX|MY|MZ|NA|NAME|NC|NE|NET|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|ORG|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PRO|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|ST|SU|SV|SY|SZ|TC|TD|TEL|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TP|TR|TRAVEL|TT|TV|TW|TZ|UA|UG|UK|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XN--0ZWM56D|测试|XN--11B5BS3A9AJ6G|परीक्षा|XN--80AKHBYKNJ4F|испытание|XN--9T4B11YI5A|테스트|XN--DEBA0AD|טעסט|XN--G6W251D|測試|XN--HGBK6AJ7F53BBA|آزمایشی|XN--HLCJ6AYA9ESC7A|பரிட்சை|XN--JXALPDLP|δοκιμή|XN--KGBECHTV|إختبار|XN--ZCKZAH|テスト|YE|YT|YU|ZA|ZM|ZW|local|loc|onion)'.
|
||||
')(?![\pN\pL\-\_])'.
|
||||
')'.
|
||||
'(?:'.
|
||||
'(?:\:\d+)?'. //:port
|
||||
'(?:/[\pN\pL$\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'@]*)?'. // /path
|
||||
'(?:\?[\pN\pL\$\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'@\/]*)?'. // ?query string
|
||||
'(?:\#[\pN\pL$\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\@/\?\#]*)?'. // #fragment
|
||||
')(?<![\?\.\,\#\,])'.
|
||||
')'.
|
||||
'$#ixu';
|
||||
return preg_match($regex, $q);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do we need to write to the database?
|
||||
*
|
||||
|
|
|
@ -231,32 +231,12 @@ class ApiStatusesUpdateAction extends ApiAuthAction
|
|||
return;
|
||||
}
|
||||
|
||||
$status_shortened = $this->auth_user->shortenlinks($this->status);
|
||||
|
||||
if (Notice::contentTooLong($status_shortened)) {
|
||||
// Note: Twitter truncates anything over 140, flags the status
|
||||
// as "truncated."
|
||||
|
||||
$this->clientError(
|
||||
sprintf(
|
||||
// TRANS: Client error displayed exceeding the maximum notice length.
|
||||
// TRANS: %d is the maximum length for a notice.
|
||||
_m('That\'s too long. Maximum notice size is %d character.',
|
||||
'That\'s too long. Maximum notice size is %d characters.',
|
||||
Notice::maxContent()),
|
||||
Notice::maxContent()
|
||||
),
|
||||
406,
|
||||
$this->format
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
/* Do not call shortenlinks until the whole notice has been build */
|
||||
|
||||
// Check for commands
|
||||
|
||||
$inter = new CommandInterpreter();
|
||||
$cmd = $inter->handle_command($this->auth_user, $status_shortened);
|
||||
$cmd = $inter->handle_command($this->auth_user, $this->status);
|
||||
|
||||
if ($cmd) {
|
||||
if ($this->supported($cmd)) {
|
||||
|
@ -299,23 +279,32 @@ class ApiStatusesUpdateAction extends ApiAuthAction
|
|||
}
|
||||
|
||||
if (isset($upload)) {
|
||||
$status_shortened .= ' ' . $upload->shortUrl();
|
||||
$this->status .= ' ' . $upload->shortUrl();
|
||||
|
||||
/* Do not call shortenlinks until the whole notice has been build */
|
||||
}
|
||||
|
||||
/* Do call shortenlinks here & check notice length since notice is about to be saved & sent */
|
||||
$status_shortened = $this->auth_user->shortenlinks($this->status);
|
||||
|
||||
if (Notice::contentTooLong($status_shortened)) {
|
||||
if (isset($upload)) {
|
||||
$upload->delete();
|
||||
}
|
||||
// TRANS: Client error displayed exceeding the maximum notice length.
|
||||
// TRANS: %d is the maximum lenth for a notice.
|
||||
$msg = _m('Maximum notice size is %d character, including attachment URL.',
|
||||
'Maximum notice size is %d characters, including attachment URL.',
|
||||
Notice::maxContent());
|
||||
$this->clientError(
|
||||
sprintf($msg, Notice::maxContent()),
|
||||
400,
|
||||
$this->format
|
||||
);
|
||||
}
|
||||
/* Use HTTP 413 error code (Request Entity Too Large)
|
||||
* instead of basic 400 for better understanding
|
||||
*/
|
||||
$this->clientError(sprintf($msg, Notice::maxContent()),
|
||||
413,
|
||||
$this->format);
|
||||
}
|
||||
|
||||
|
||||
$content = html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8');
|
||||
|
||||
$options = array('reply_to' => $reply_to);
|
||||
|
|
|
@ -170,7 +170,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
|||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link,'alternate', 'text/html');
|
||||
|
|
|
@ -266,16 +266,15 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
|||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link,'alternate', 'text/html');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user, $title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when coming across a non-supported API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
$this->clientError(_('API method not found.'), 404);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +288,13 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
|||
{
|
||||
$notices = array();
|
||||
|
||||
$stream = new InboxNoticeStream($this->user);
|
||||
$profile = null;
|
||||
|
||||
if (isset($this->auth_user)) {
|
||||
$profile = $this->auth_user->getProfile();
|
||||
}
|
||||
|
||||
$stream = new InboxNoticeStream($this->user, $profile);
|
||||
|
||||
$notice = $stream->getNotices(($this->page-1) * $this->count,
|
||||
$this->count,
|
||||
|
|
|
@ -106,10 +106,8 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
|||
|
||||
$self = $this->getSelfUri();
|
||||
|
||||
$link = common_local_url(
|
||||
'ApiTimelineGroup',
|
||||
array('nickname' => $this->group->nickname)
|
||||
);
|
||||
$link = common_local_url('showgroup',
|
||||
array('nickname' => $this->group->nickname));
|
||||
|
||||
switch($this->format) {
|
||||
case 'xml':
|
||||
|
@ -135,7 +133,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
|||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($atom->title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
|
|
|
@ -169,7 +169,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
|||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
|
@ -192,7 +192,13 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
|||
{
|
||||
$notices = array();
|
||||
|
||||
$stream = new InboxNoticeStream($this->user);
|
||||
$profile = null;
|
||||
|
||||
if (isset($this->auth_user)) {
|
||||
$profile = $this->auth_user->getProfile();
|
||||
}
|
||||
|
||||
$stream = new InboxNoticeStream($this->user, $profile);
|
||||
|
||||
$notice = $stream->getNotices(($this->page-1) * $this->count,
|
||||
$this->count,
|
||||
|
|
|
@ -170,7 +170,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
|||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
|
@ -193,10 +193,18 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
|||
{
|
||||
$notices = array();
|
||||
|
||||
$notice = $this->user->getReplies(
|
||||
($this->page - 1) * $this->count, $this->count,
|
||||
$this->since_id, $this->max_id
|
||||
);
|
||||
if (empty($this->auth_user)) {
|
||||
$profile = null;
|
||||
} else {
|
||||
$profile = $this->auth_user->getProfile();
|
||||
}
|
||||
|
||||
$stream = new ReplyNoticeStream($this->user->id, $profile);
|
||||
|
||||
$notice = $stream->getNotices(($this->page - 1) * $this->count,
|
||||
$this->count,
|
||||
$this->since_id,
|
||||
$this->max_id);
|
||||
|
||||
while ($notice->fetch()) {
|
||||
$notices[] = clone($notice);
|
||||
|
|
|
@ -235,7 +235,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
|||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
|
@ -258,14 +258,18 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
|||
{
|
||||
$notices = array();
|
||||
|
||||
$notice = Notice::publicStream(
|
||||
($this->page - 1) * $this->count, $this->count, $this->since_id,
|
||||
$this->max_id
|
||||
);
|
||||
$profile = ($this->auth_user) ? $this->auth_user->getProfile() : null;
|
||||
|
||||
while ($notice->fetch()) {
|
||||
$notices[] = clone($notice);
|
||||
}
|
||||
$stream = new PublicNoticeStream($profile);
|
||||
|
||||
$notice = $stream->getNotices(($this->page - 1) * $this->count,
|
||||
$this->count,
|
||||
$this->since_id,
|
||||
$this->max_id);
|
||||
|
||||
$notices = $notice->fetchAll();
|
||||
|
||||
NoticeList::prefill($notices);
|
||||
|
||||
return $notices;
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
|||
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
|
|
|
@ -115,7 +115,15 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
|||
array('nickname' => $this->auth_user->nickname)
|
||||
);
|
||||
|
||||
// This is a really bad query for some reason
|
||||
|
||||
if (!common_config('performance', 'high')) {
|
||||
$strm = $this->auth_user->repeatsOfMe($offset, $limit, $this->since_id, $this->max_id);
|
||||
} else {
|
||||
$strm = new Notice();
|
||||
$strm->whereAdd('0 = 1');
|
||||
$strm->find();
|
||||
}
|
||||
|
||||
switch ($this->format) {
|
||||
case 'xml':
|
||||
|
@ -137,7 +145,7 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
|||
$this->raw($atom->getString());
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
|
|
|
@ -153,7 +153,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
|||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
|
|
|
@ -202,7 +202,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
|||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($atom->title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
|
@ -447,7 +447,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
|||
} else {
|
||||
$group = User_group::staticGet('uri', $uri);
|
||||
if (!empty($group)) {
|
||||
$options['groups'][] = $uri;
|
||||
$options['groups'][] = $group->id;
|
||||
} else {
|
||||
// @fixme: hook for discovery here
|
||||
common_log(LOG_WARNING, sprintf('AtomPub post with unknown attention URI %s', $uri));
|
||||
|
|
|
@ -73,6 +73,7 @@ class ApprovesubAction extends Action
|
|||
|
||||
if (empty($this->request)) {
|
||||
// TRANS: Client error displayed trying to approve subscription for a non-existing request.
|
||||
// TRANS: %s is a user nickname.
|
||||
$this->clientError(sprintf(_('%s is not in the moderation queue for your subscriptions.'), $this->profile->nickname), 403);
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,9 @@ class AttachmentAction extends Action
|
|||
function showSections() {
|
||||
$ns = new AttachmentNoticeSection($this);
|
||||
$ns->show();
|
||||
if (!common_config('performance', 'high')) {
|
||||
$atcs = new AttachmentTagCloudSection($this);
|
||||
$atcs->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class BlockedfromgroupAction extends GroupDesignAction
|
||||
class BlockedfromgroupAction extends GroupAction
|
||||
{
|
||||
var $page = null;
|
||||
|
||||
|
@ -122,12 +122,6 @@ class BlockedfromgroupAction extends GroupDesignAction
|
|||
_('A list of the users blocked from joining this group.'));
|
||||
}
|
||||
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$offset = ($this->page-1) * PROFILES_PER_PAGE;
|
||||
|
|
|
@ -123,13 +123,49 @@ class ConversationAction extends Action
|
|||
*/
|
||||
function showContent()
|
||||
{
|
||||
$tnl = new FullThreadedNoticeList($this->notices, $this, $this->userProfile);
|
||||
$user = common_current_user();
|
||||
|
||||
$cnt = $tnl->show();
|
||||
if (!empty($user) && $user->conversationTree()) {
|
||||
$nl = new ConversationTree($this->notices, $this);
|
||||
} else {
|
||||
$nl = new FullThreadedNoticeList($this->notices, $this, $this->userProfile);
|
||||
}
|
||||
|
||||
$cnt = $nl->show();
|
||||
}
|
||||
|
||||
function isReadOnly()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function getFeeds()
|
||||
{
|
||||
|
||||
return array(new Feed(Feed::JSON,
|
||||
common_local_url('apiconversation',
|
||||
array(
|
||||
'id' => $this->id,
|
||||
'format' => 'as')),
|
||||
// TRANS: Title for link to notice feed.
|
||||
// TRANS: %s is a user nickname.
|
||||
_('Conversation feed (Activity Streams JSON)')),
|
||||
new Feed(Feed::RSS2,
|
||||
common_local_url('apiconversation',
|
||||
array(
|
||||
'id' => $this->id,
|
||||
'format' => 'rss')),
|
||||
// TRANS: Title for link to notice feed.
|
||||
// TRANS: %s is a user nickname.
|
||||
_('Conversation feed (RSS 2.0)')),
|
||||
new Feed(Feed::ATOM,
|
||||
common_local_url('apiconversation',
|
||||
array(
|
||||
'id' => $this->id,
|
||||
'format' => 'atom')),
|
||||
// TRANS: Title for link to notice feed.
|
||||
// TRANS: %s is a user nickname.
|
||||
_('Conversation feed (Activity Streams JSON)')));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -320,6 +320,6 @@ class DeleteAccountForm extends Form
|
|||
'submit',
|
||||
null,
|
||||
// TRANS: Button title for user account deletion.
|
||||
_('Permanently delete your account'));
|
||||
_('Permanently delete your account.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,738 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Design administration panel
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: 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/>.
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Administer design settings
|
||||
*
|
||||
* @category Admin
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class DesignadminpanelAction extends AdminPanelAction
|
||||
{
|
||||
/* The default site design */
|
||||
var $design = null;
|
||||
|
||||
/**
|
||||
* Returns the page title
|
||||
*
|
||||
* @return string page title
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Message used as title for design settings for the site.
|
||||
return _('Design');
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions for using this form.
|
||||
*
|
||||
* @return string instructions
|
||||
*/
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for design adminsitration panel.
|
||||
return _('Design settings for this StatusNet site');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default design and show the design admin panel form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showForm()
|
||||
{
|
||||
$this->design = Design::siteDesign();
|
||||
$form = new DesignAdminPanelForm($this);
|
||||
$form->show();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings from the form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function saveSettings()
|
||||
{
|
||||
if ($this->arg('save')) {
|
||||
$this->saveDesignSettings();
|
||||
} else if ($this->arg('defaults')) {
|
||||
$this->restoreDefaults();
|
||||
} else {
|
||||
// TRANS: Client error displayed when the submitted form contains unexpected data.
|
||||
$this->clientError(_('Unexpected form submission.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the new design settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function saveDesignSettings()
|
||||
{
|
||||
// Workaround for PHP returning empty $_POST and $_FILES when POST
|
||||
// length > post_max_size in php.ini
|
||||
|
||||
if (empty($_FILES)
|
||||
&& empty($_POST)
|
||||
&& ($_SERVER['CONTENT_LENGTH'] > 0)
|
||||
) {
|
||||
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
|
||||
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
|
||||
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
|
||||
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
|
||||
intval($_SERVER['CONTENT_LENGTH']));
|
||||
$this->clientException(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
|
||||
return;
|
||||
}
|
||||
|
||||
// check for file uploads
|
||||
|
||||
$bgimage = $this->saveBackgroundImage();
|
||||
$customTheme = $this->saveCustomTheme();
|
||||
|
||||
$oldtheme = common_config('site', 'theme');
|
||||
if ($customTheme) {
|
||||
// This feels pretty hacky :D
|
||||
$this->args['theme'] = $customTheme;
|
||||
$themeChanged = true;
|
||||
} else {
|
||||
$themeChanged = ($this->trimmed('theme') != $oldtheme);
|
||||
}
|
||||
|
||||
static $settings = array('theme', 'logo', 'ssllogo');
|
||||
|
||||
$values = array();
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
$values[$setting] = $this->trimmed($setting);
|
||||
}
|
||||
|
||||
$this->validate($values);
|
||||
|
||||
$config = new Config();
|
||||
|
||||
$config->query('BEGIN');
|
||||
|
||||
if ($themeChanged) {
|
||||
// If the theme has changed, reset custom colors and let them pick
|
||||
// up the new theme's defaults.
|
||||
$colors = array('background', 'content', 'sidebar', 'text', 'link');
|
||||
foreach ($colors as $colorKey) {
|
||||
// Clear from global config so we see defaults on this page...
|
||||
$GLOBALS['config']['design'][$colorKey . 'color'] = false;
|
||||
|
||||
// And remove old settings from DB...
|
||||
$this->deleteSetting('design', $colorKey . 'color');
|
||||
}
|
||||
} else {
|
||||
// Only save colors from the form if the theme has not changed.
|
||||
//
|
||||
// @fixme a future more ajaxy form should allow theme switch
|
||||
// and color customization in one step.
|
||||
|
||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
||||
$tcolor = new WebColor($this->trimmed('design_text'));
|
||||
$lcolor = new WebColor($this->trimmed('design_links'));
|
||||
|
||||
Config::save('design', 'backgroundcolor', $bgcolor->intValue());
|
||||
Config::save('design', 'contentcolor', $ccolor->intValue());
|
||||
Config::save('design', 'sidebarcolor', $sbcolor->intValue());
|
||||
Config::save('design', 'textcolor', $tcolor->intValue());
|
||||
Config::save('design', 'linkcolor', $lcolor->intValue());
|
||||
}
|
||||
|
||||
$onoff = $this->arg('design_background-image_onoff');
|
||||
|
||||
$on = false;
|
||||
$off = false;
|
||||
|
||||
if ($onoff == 'on') {
|
||||
$on = true;
|
||||
} else {
|
||||
$off = true;
|
||||
}
|
||||
|
||||
$tile = $this->boolean('design_background-image_repeat');
|
||||
|
||||
// Hack to use Design's bit setter
|
||||
$scratch = new Design();
|
||||
$scratch->setDisposition($on, $off, $tile);
|
||||
|
||||
Config::save('design', 'disposition', $scratch->disposition);
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
Config::save('site', $setting, $values[$setting]);
|
||||
}
|
||||
|
||||
if (isset($bgimage)) {
|
||||
Config::save('design', 'backgroundimage', $bgimage);
|
||||
}
|
||||
|
||||
if (common_config('custom_css', 'enabled')) {
|
||||
$css = $this->arg('css');
|
||||
if ($css != common_config('custom_css', 'css')) {
|
||||
Config::save('custom_css', 'css', $css);
|
||||
}
|
||||
}
|
||||
|
||||
$config->query('COMMIT');
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the default design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function restoreDefaults()
|
||||
{
|
||||
$this->deleteSetting('site', 'logo');
|
||||
$this->deleteSetting('site', 'ssllogo');
|
||||
$this->deleteSetting('site', 'theme');
|
||||
|
||||
$settings = array(
|
||||
'theme', 'backgroundimage', 'backgroundcolor', 'contentcolor',
|
||||
'sidebarcolor', 'textcolor', 'linkcolor', 'disposition'
|
||||
);
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
$this->deleteSetting('design', $setting);
|
||||
}
|
||||
|
||||
// XXX: Should we restore the default dir settings, etc.? --Z
|
||||
|
||||
// XXX: I can't get it to show the new settings without forcing
|
||||
// this terrible reload -- FIX ME!
|
||||
common_redirect(common_local_url('designadminpanel'), 303);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the background image if the user uploaded one
|
||||
*
|
||||
* @return string $filename the filename of the image
|
||||
*/
|
||||
function saveBackgroundImage()
|
||||
{
|
||||
$filename = null;
|
||||
if (isset($_FILES['design_background-image_file']['error']) &&
|
||||
$_FILES['design_background-image_file']['error'] ==
|
||||
UPLOAD_ERR_OK) {
|
||||
|
||||
$filepath = null;
|
||||
|
||||
try {
|
||||
$imagefile =
|
||||
ImageFile::fromUpload('design_background-image_file');
|
||||
} catch (Exception $e) {
|
||||
$this->clientError('Unable to save background image.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Note: site design background image has a special filename
|
||||
|
||||
$filename = Design::filename('site-design-background',
|
||||
image_type_to_extension($imagefile->type),
|
||||
common_timestamp());
|
||||
|
||||
$filepath = Design::path($filename);
|
||||
|
||||
move_uploaded_file($imagefile->filepath, $filepath);
|
||||
|
||||
// delete any old backround img laying around
|
||||
|
||||
if (isset($this->design->backgroundimage)) {
|
||||
@unlink(Design::path($design->backgroundimage));
|
||||
}
|
||||
|
||||
return $filename;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the custom theme if the user uploaded one.
|
||||
*
|
||||
* @return mixed custom theme name, if succesful, or null if no theme upload.
|
||||
* @throws ClientException for invalid theme archives
|
||||
* @throws ServerException if trouble saving the theme files
|
||||
*/
|
||||
function saveCustomTheme()
|
||||
{
|
||||
if (common_config('theme_upload', 'enabled') &&
|
||||
$_FILES['design_upload_theme']['error'] == UPLOAD_ERR_OK) {
|
||||
|
||||
$upload = ThemeUploader::fromUpload('design_upload_theme');
|
||||
$basedir = common_config('local', 'dir');
|
||||
if (empty($basedir)) {
|
||||
$basedir = INSTALLDIR . '/local';
|
||||
}
|
||||
$name = 'custom'; // @todo allow multiples, custom naming?
|
||||
$outdir = $basedir . '/theme/' . $name;
|
||||
$upload->extract($outdir);
|
||||
return $name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to validate setting values
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function validate(&$values)
|
||||
{
|
||||
if (!empty($values['logo']) &&
|
||||
!Validate::uri($values['logo'], array('allowed_schemes' => array('http', 'https')))) {
|
||||
// TRANS: Client error displayed when a logo URL does is not valid.
|
||||
$this->clientError(_('Invalid logo URL.'));
|
||||
}
|
||||
|
||||
if (!empty($values['ssllogo']) &&
|
||||
!Validate::uri($values['ssllogo'], array('allowed_schemes' => array('https')))) {
|
||||
// TRANS: Client error displayed when an SSL logo URL is invalid.
|
||||
$this->clientError(_('Invalid SSL logo URL.'));
|
||||
}
|
||||
|
||||
if (!in_array($values['theme'], Theme::listAvailable())) {
|
||||
// TRANS: Client error displayed when a theme is submitted through the form that is not in the theme list.
|
||||
// TRANS: %s is the chosen unavailable theme.
|
||||
$this->clientError(sprintf(_('Theme not available: %s.'), $values['theme']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Farbtastic stylesheet
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showStylesheets()
|
||||
{
|
||||
parent::showStylesheets();
|
||||
$this->cssLink('js/farbtastic/farbtastic.css',null,'screen, projection, tv');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Farbtastic scripts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showScripts()
|
||||
{
|
||||
parent::showScripts();
|
||||
|
||||
$this->script('farbtastic/farbtastic.js');
|
||||
$this->script('userdesign.go.js');
|
||||
|
||||
$this->autofocus('design_background-image_file');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DesignAdminPanelForm extends AdminForm
|
||||
{
|
||||
|
||||
/**
|
||||
* ID of the form
|
||||
*
|
||||
* @return int ID of the form
|
||||
*/
|
||||
function id()
|
||||
{
|
||||
return 'form_design_admin_panel';
|
||||
}
|
||||
|
||||
/**
|
||||
* class of the form
|
||||
*
|
||||
* @return string class of the form
|
||||
*/
|
||||
function formClass()
|
||||
{
|
||||
return 'form_settings';
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP method used to submit the form
|
||||
*
|
||||
* For image data we need to send multipart/form-data
|
||||
* so we set that here too
|
||||
*
|
||||
* @return string the method to use for submitting
|
||||
*/
|
||||
function method()
|
||||
{
|
||||
$this->enctype = 'multipart/form-data';
|
||||
|
||||
return 'post';
|
||||
}
|
||||
|
||||
/**
|
||||
* Action of the form
|
||||
*
|
||||
* @return string URL of the action
|
||||
*/
|
||||
function action()
|
||||
{
|
||||
return common_local_url('designadminpanel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Data elements of the form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formData()
|
||||
{
|
||||
$this->showLogo();
|
||||
$this->showTheme();
|
||||
$this->showBackground();
|
||||
$this->showColors();
|
||||
$this->showAdvanced();
|
||||
}
|
||||
|
||||
function showLogo()
|
||||
{
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_logo'));
|
||||
// TRANS: Fieldset legend for form to change logo.
|
||||
$this->out->element('legend', null, _('Change logo'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->input('logo',
|
||||
// TRANS: Field label for StatusNet site logo.
|
||||
_('Site logo'),
|
||||
// TRANS: Title for field label for StatusNet site logo.
|
||||
'Logo for the site (full URL).');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('ssllogo',
|
||||
// TRANS: Field label for SSL StatusNet site logo.
|
||||
_('SSL logo'),
|
||||
// TRANS: Title for field label for SSL StatusNet site logo.
|
||||
'Logo to show on SSL pages.');
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
}
|
||||
|
||||
function showTheme()
|
||||
{
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_theme'));
|
||||
// TRANS: Fieldset legend for form change StatusNet site's theme.
|
||||
$this->out->element('legend', null, _('Change theme'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$themes = Theme::listAvailable();
|
||||
|
||||
// XXX: listAvailable() can return an empty list if you
|
||||
// screw up your settings, so just in case:
|
||||
|
||||
if (empty($themes)) {
|
||||
$themes = array('default', 'default');
|
||||
}
|
||||
|
||||
asort($themes);
|
||||
$themes = array_combine($themes, $themes);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for dropdown to choose site theme.
|
||||
$this->out->dropdown('theme', _('Site theme'),
|
||||
// TRANS: Title for field label for dropdown to choose site theme.
|
||||
$themes, _('Theme for the site.'),
|
||||
false, $this->value('theme'));
|
||||
$this->unli();
|
||||
|
||||
if (common_config('theme_upload', 'enabled')) {
|
||||
$this->li();
|
||||
// TRANS: Field label for uploading a cutom theme.
|
||||
$this->out->element('label', array('for' => 'design_upload_theme'), _('Custom theme'));
|
||||
$this->out->element('input', array('id' => 'design_upload_theme',
|
||||
'name' => 'design_upload_theme',
|
||||
'type' => 'file'));
|
||||
// TRANS: Form instructions for uploading a cutom StatusNet theme.
|
||||
$this->out->element('p', 'form_guide', _('You can upload a custom StatusNet theme as a .ZIP archive.'));
|
||||
$this->unli();
|
||||
}
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
}
|
||||
|
||||
function showBackground()
|
||||
{
|
||||
$design = $this->out->design;
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' =>
|
||||
'settings_design_background-image'));
|
||||
// TRANS: Fieldset legend for theme background image.
|
||||
$this->out->element('legend', null, _('Change background image'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->out->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||
'type' => 'hidden',
|
||||
'id' => 'MAX_FILE_SIZE',
|
||||
'value' => ImageFile::maxFileSizeInt()));
|
||||
$this->out->element('label', array('for' => 'design_background-image_file'),
|
||||
// TRANS: Field label for background image on theme designer page.
|
||||
_('Background'));
|
||||
$this->out->element('input', array('name' => 'design_background-image_file',
|
||||
'type' => 'file',
|
||||
'id' => 'design_background-image_file'));
|
||||
$this->out->element('p', 'form_guide',
|
||||
// TRANS: Form guide for background image upload form on theme designer page.
|
||||
sprintf(_('You can upload a background image for the site. ' .
|
||||
'The maximum file size is %1$s.'), ImageFile::maxFileSize()));
|
||||
$this->unli();
|
||||
|
||||
if (!empty($design->backgroundimage)) {
|
||||
|
||||
$this->out->elementStart('li', array('id' =>
|
||||
'design_background-image_onoff'));
|
||||
|
||||
$this->out->element('img', array('src' =>
|
||||
Design::url($design->backgroundimage)));
|
||||
|
||||
$attrs = array('name' => 'design_background-image_onoff',
|
||||
'type' => 'radio',
|
||||
'id' => 'design_background-image_on',
|
||||
'class' => 'radio',
|
||||
'value' => 'on');
|
||||
|
||||
if ($design->disposition & BACKGROUND_ON) {
|
||||
$attrs['checked'] = 'checked';
|
||||
}
|
||||
|
||||
$this->out->element('input', $attrs);
|
||||
|
||||
$this->out->element('label', array('for' => 'design_background-image_on',
|
||||
'class' => 'radio'),
|
||||
// TRANS: Used as radio button label to add a background image.
|
||||
_('On'));
|
||||
|
||||
$attrs = array('name' => 'design_background-image_onoff',
|
||||
'type' => 'radio',
|
||||
'id' => 'design_background-image_off',
|
||||
'class' => 'radio',
|
||||
'value' => 'off');
|
||||
|
||||
if ($design->disposition & BACKGROUND_OFF) {
|
||||
$attrs['checked'] = 'checked';
|
||||
}
|
||||
|
||||
$this->out->element('input', $attrs);
|
||||
|
||||
$this->out->element('label', array('for' => 'design_background-image_off',
|
||||
'class' => 'radio'),
|
||||
// TRANS: Used as radio button label to not add a background image.
|
||||
_('Off'));
|
||||
// TRANS: Form guide for turning background image on or off on theme designer page.
|
||||
$this->out->element('p', 'form_guide', _('Turn background image on or off.'));
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->out->checkbox('design_background-image_repeat',
|
||||
// TRANS: Checkbox label to title background image on theme designer page.
|
||||
_('Tile background image'),
|
||||
($design->disposition & BACKGROUND_TILE) ? true : false);
|
||||
$this->unli();
|
||||
}
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
$this->out->elementEnd('fieldset');
|
||||
}
|
||||
|
||||
function showColors()
|
||||
{
|
||||
$design = $this->out->design;
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_color'));
|
||||
// TRANS: Fieldset legend for theme colors.
|
||||
$this->out->element('legend', null, _('Change colors'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
try {
|
||||
// @fixme avoid loop unrolling in non-performance-critical contexts like this
|
||||
|
||||
$bgcolor = new WebColor($design->backgroundcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for background color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-1'), _('Background'));
|
||||
$this->out->element('input', array('name' => 'design_background',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-1',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
$ccolor = new WebColor($design->contentcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for content color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-2'), _('Content'));
|
||||
$this->out->element('input', array('name' => 'design_content',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-2',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
$sbcolor = new WebColor($design->sidebarcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for sidebar color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-3'), _('Sidebar'));
|
||||
$this->out->element('input', array('name' => 'design_sidebar',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-3',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
$tcolor = new WebColor($design->textcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for text color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-4'), _('Text'));
|
||||
$this->out->element('input', array('name' => 'design_text',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-4',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
$lcolor = new WebColor($design->linkcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for link color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-5'), _('Links'));
|
||||
$this->out->element('input', array('name' => 'design_links',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-5',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
} catch (WebColorException $e) {
|
||||
// @fixme normalize them individually!
|
||||
common_log(LOG_ERR, 'Bad color values in site design: ' .
|
||||
$e->getMessage());
|
||||
}
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
|
||||
function showAdvanced()
|
||||
{
|
||||
if (common_config('custom_css', 'enabled')) {
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_advanced'));
|
||||
// TRANS: Fieldset legend for advanced theme design settings.
|
||||
$this->out->element('legend', null, _('Advanced'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for custom CSS.
|
||||
$this->out->element('label', array('for' => 'css'), _('Custom CSS'));
|
||||
$this->out->element('textarea', array('name' => 'css',
|
||||
'id' => 'css',
|
||||
'cols' => '50',
|
||||
'rows' => '10'),
|
||||
strval(common_config('custom_css', 'css')));
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action elements
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formActions()
|
||||
{
|
||||
// TRANS: Button text for resetting theme settings.
|
||||
$this->out->submit('defaults', _m('BUTTON','Use defaults'), 'submit form_action-default',
|
||||
// TRANS: Title for button for resetting theme settings.
|
||||
'defaults', _('Restore default designs.'));
|
||||
|
||||
$this->out->element('input', array('id' => 'settings_design_reset',
|
||||
'type' => 'reset',
|
||||
// TRANS: Button text for resetting theme settings.
|
||||
'value' => 'Reset',
|
||||
'class' => 'submit form_action-primary',
|
||||
// TRANS: Title for button for resetting theme settings.
|
||||
'title' => _('Reset back to default.')));
|
||||
|
||||
$this->out->submit('save',
|
||||
// TRANS: Button text for saving theme settings.
|
||||
_m('BUTTON','Save'),
|
||||
'submit form_action-secondary',
|
||||
'save',
|
||||
// TRANS: Title for button for saving theme settings.
|
||||
_('Save design.'));
|
||||
}
|
||||
}
|
|
@ -162,4 +162,72 @@ class DocAction extends Action
|
|||
Event::handle('EndLoadDoc', array($this->title, &$this->output));
|
||||
}
|
||||
}
|
||||
|
||||
function showLocalNav()
|
||||
{
|
||||
$menu = new DocNav($this);
|
||||
$menu->show();
|
||||
}
|
||||
}
|
||||
|
||||
class DocNav extends Menu
|
||||
{
|
||||
function show()
|
||||
{
|
||||
$stub = new HomeStubNav($this->action);
|
||||
$this->submenu(_m('MENU','Home'), $stub);
|
||||
|
||||
$docs = new DocListNav($this->action);
|
||||
$this->submenu(_m('MENU','Docs'), $docs);
|
||||
}
|
||||
}
|
||||
|
||||
class DocListNav extends Menu
|
||||
{
|
||||
function getItems()
|
||||
{
|
||||
$items = array();
|
||||
|
||||
if (Event::handle('StartDocsMenu', array(&$items))) {
|
||||
|
||||
$items = array(array('doc',
|
||||
array('title' => 'help'),
|
||||
_m('MENU', 'Help'),
|
||||
_('Getting started'),
|
||||
'nav_doc_help'),
|
||||
array('doc',
|
||||
array('title' => 'about'),
|
||||
_m('MENU', 'About'),
|
||||
_('About this site'),
|
||||
'nav_doc_about'),
|
||||
array('doc',
|
||||
array('title' => 'faq'),
|
||||
_m('MENU', 'FAQ'),
|
||||
_('Frequently asked questions'),
|
||||
'nav_doc_faq'),
|
||||
array('doc',
|
||||
array('title' => 'contact'),
|
||||
_m('MENU', 'Contact'),
|
||||
_('Contact info'),
|
||||
'nav_doc_contact'),
|
||||
array('doc',
|
||||
array('title' => 'tags'),
|
||||
_m('MENU', 'Tags'),
|
||||
_('Using tags'),
|
||||
'nav_doc_tags'),
|
||||
array('doc',
|
||||
array('title' => 'groups'),
|
||||
_m('MENU', 'Groups'),
|
||||
_('Using groups'),
|
||||
'nav_doc_groups'),
|
||||
array('doc',
|
||||
array('title' => 'api'),
|
||||
_m('MENU', 'API'),
|
||||
_('RESTful API'),
|
||||
'nav_doc_api'));
|
||||
|
||||
Event::handle('EndDocsMenu', array(&$items));
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category Applications
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class EditApplicationAction extends OwnerDesignAction
|
||||
class EditApplicationAction extends Action
|
||||
{
|
||||
var $msg = null;
|
||||
var $owner = null;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -45,7 +45,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class EditgroupAction extends GroupDesignAction
|
||||
class EditgroupAction extends GroupAction
|
||||
{
|
||||
var $msg;
|
||||
|
||||
|
@ -139,12 +139,6 @@ class EditgroupAction extends GroupDesignAction
|
|||
$this->showPage();
|
||||
}
|
||||
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$form = new GroupEditForm($this, $this->group);
|
||||
|
@ -165,7 +159,7 @@ class EditgroupAction extends GroupDesignAction
|
|||
function showScripts()
|
||||
{
|
||||
parent::showScripts();
|
||||
$this->autofocus('nickname');
|
||||
$this->autofocus('newnickname');
|
||||
}
|
||||
|
||||
function trySave()
|
||||
|
@ -179,7 +173,7 @@ class EditgroupAction extends GroupDesignAction
|
|||
|
||||
if (Event::handle('StartGroupSaveForm', array($this))) {
|
||||
|
||||
$nickname = Nickname::normalize($this->trimmed('nickname'));
|
||||
$nickname = Nickname::normalize($this->trimmed('newnickname'));
|
||||
$fullname = $this->trimmed('fullname');
|
||||
$homepage = $this->trimmed('homepage');
|
||||
$description = $this->trimmed('description');
|
||||
|
|
|
@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class EditpeopletagAction extends OwnerDesignAction
|
||||
class EditpeopletagAction extends Action
|
||||
{
|
||||
var $msg, $confirm, $confirm_args=array();
|
||||
|
||||
|
@ -71,7 +71,11 @@ class EditpeopletagAction extends OwnerDesignAction
|
|||
}
|
||||
|
||||
$id = $this->arg('id');
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$tagger_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
}
|
||||
$tag_arg = $this->arg('tag');
|
||||
|
||||
$tagger = common_canonical_nickname($tagger_arg);
|
||||
|
@ -293,7 +297,7 @@ class EditpeopletagAction extends OwnerDesignAction
|
|||
|
||||
if (!$result) {
|
||||
common_log_db_error($this->group, 'UPDATE', __FILE__);
|
||||
// TRANS: TRANS: Server error displayed when updating a list fails.
|
||||
// TRANS: Server error displayed when updating a list fails.
|
||||
$this->serverError(_('Could not update list.'));
|
||||
}
|
||||
|
||||
|
|
|
@ -172,11 +172,8 @@ class FavoritedAction extends Action
|
|||
*/
|
||||
function showContent()
|
||||
{
|
||||
$pop = new Popularity();
|
||||
$pop->offset = ($this->page - 1) * NOTICES_PER_PAGE;
|
||||
$pop->limit = NOTICES_PER_PAGE;
|
||||
$pop->expiry = 600;
|
||||
$notice = $pop->getNotices();
|
||||
$stream = new PopularNoticeStream(Profile::current());
|
||||
$notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE+1);
|
||||
|
||||
$nl = new NoticeList($notice, $this);
|
||||
|
||||
|
|
|
@ -1,319 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Saves a design for a given group.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: 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/>.
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/designsettings.php';
|
||||
|
||||
/**
|
||||
* Set a group's design
|
||||
*
|
||||
* Saves a design for a given group
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
{
|
||||
var $group = null;
|
||||
|
||||
/**
|
||||
* Sets the right action for the form, and passes request args into
|
||||
* the base action
|
||||
*
|
||||
* @param array $args misc. arguments
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed trying to change group design settings while not logged in.
|
||||
$this->clientError(_('You must be logged in to edit a group.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$nickname_arg = $this->trimmed('nickname');
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
||||
if ($nickname_arg != $nickname) {
|
||||
$args = array('nickname' => $nickname);
|
||||
common_redirect(common_local_url('groupdesignsettings', $args), 301);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
// TRANS: Client error displayed trying to change group design settings without providing a group nickname.
|
||||
$this->clientError(_('No nickname.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$groupid = $this->trimmed('groupid');
|
||||
|
||||
if ($groupid) {
|
||||
$this->group = User_group::staticGet('id', $groupid);
|
||||
} else {
|
||||
$local = Local_group::staticGet('nickname', $nickname);
|
||||
if ($local) {
|
||||
$this->group = User_group::staticGet('id', $local->group_id);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed trying to change group design settings while providing a nickname for a non-existing group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!$cur->isAdmin($this->group)) {
|
||||
// TRANS: Client error displayed trying to change group design settings without being a (group) admin.
|
||||
$this->clientError(_('You must be an admin to edit the group.'), 403);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->submitaction = common_local_url('groupdesignsettings',
|
||||
array('nickname' => $this->group->nickname));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A design for this action
|
||||
*
|
||||
* if the group attribute has been set, returns that group's
|
||||
* design.
|
||||
*
|
||||
* @return Design a design object to use
|
||||
*/
|
||||
function getDesign()
|
||||
{
|
||||
|
||||
if (empty($this->group)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->group->getDesign();
|
||||
}
|
||||
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title group design settings page.
|
||||
return _('Group design');
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions for use
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for group design settings page.
|
||||
return _('Customize the way your group looks ' .
|
||||
'with a background image and a colour palette of your choice.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to show group nav stuff
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to show default nav stuff
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function showLocalNav()
|
||||
{
|
||||
Action::showLocalNav();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the design we want to edit
|
||||
*
|
||||
* @return Design
|
||||
*/
|
||||
function getWorkingDesign()
|
||||
{
|
||||
$design = null;
|
||||
|
||||
if (isset($this->group)) {
|
||||
$design = $this->group->getDesign();
|
||||
}
|
||||
|
||||
return $design;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content area of the page
|
||||
*
|
||||
* Shows a form for changing the design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showContent()
|
||||
{
|
||||
$design = $this->getWorkingDesign();
|
||||
|
||||
if (empty($design)) {
|
||||
$design = Design::siteDesign();
|
||||
}
|
||||
|
||||
$this->showDesignForm($design);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save or update the group's design settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function saveDesign()
|
||||
{
|
||||
try {
|
||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
||||
$tcolor = new WebColor($this->trimmed('design_text'));
|
||||
$lcolor = new WebColor($this->trimmed('design_links'));
|
||||
} catch (WebColorException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
$onoff = $this->arg('design_background-image_onoff');
|
||||
|
||||
$on = false;
|
||||
$off = false;
|
||||
$tile = false;
|
||||
|
||||
if ($onoff == 'on') {
|
||||
$on = true;
|
||||
} else {
|
||||
$off = true;
|
||||
}
|
||||
|
||||
$repeat = $this->boolean('design_background-image_repeat');
|
||||
|
||||
if ($repeat) {
|
||||
$tile = true;
|
||||
}
|
||||
|
||||
$design = $this->group->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
// update design
|
||||
|
||||
$original = clone($design);
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error displayed when group design settings could not be updated because of an application issue.
|
||||
$this->showForm(_('Unable to update your design settings.'));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$this->group->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
|
||||
$design = new Design();
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($this->group);
|
||||
$this->group->design_id = $id;
|
||||
$result = $this->group->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
$this->group->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->group->query('COMMIT');
|
||||
}
|
||||
|
||||
$this->saveBackgroundImage($design);
|
||||
|
||||
// TRANS: Form text to confirm saved group design settings.
|
||||
$this->showForm(_('Design preferences saved.'), true);
|
||||
}
|
||||
}
|
|
@ -23,7 +23,7 @@
|
|||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -49,7 +49,7 @@ define('MAX_ORIGINAL', 480);
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class GrouplogoAction extends GroupDesignAction
|
||||
class GrouplogoAction extends GroupAction
|
||||
{
|
||||
var $mode = null;
|
||||
var $imagefile = null;
|
||||
|
@ -457,10 +457,4 @@ class GrouplogoAction extends GroupDesignAction
|
|||
|
||||
$this->autofocus('avatarfile');
|
||||
}
|
||||
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php';
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class GroupmembersAction extends GroupDesignAction
|
||||
class GroupmembersAction extends GroupAction
|
||||
{
|
||||
var $page = null;
|
||||
|
||||
|
@ -55,44 +55,9 @@ class GroupmembersAction extends GroupDesignAction
|
|||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
||||
if ($nickname_arg != $nickname) {
|
||||
$args = array('nickname' => $nickname);
|
||||
if ($this->page != 1) {
|
||||
$args['page'] = $this->page;
|
||||
}
|
||||
common_redirect(common_local_url('groupmembers', $args), 301);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
// TRANS: Client error displayed when trying to view group members without providing a group nickname.
|
||||
$this->clientError(_('No nickname.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$local = Local_group::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$local) {
|
||||
// TRANS: Client error displayed when trying to view group members for a non-existing group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->group = User_group::staticGet('id', $local->group_id);
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed when trying to view group members for an object that is not a group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -125,12 +90,6 @@ class GroupmembersAction extends GroupDesignAction
|
|||
_('A list of the users in this group.'));
|
||||
}
|
||||
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$offset = ($this->page-1) * PROFILES_PER_PAGE;
|
||||
|
@ -145,8 +104,6 @@ class GroupmembersAction extends GroupDesignAction
|
|||
$cnt = $member_list->show();
|
||||
}
|
||||
|
||||
$members->free();
|
||||
|
||||
$this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
|
||||
$this->page, 'groupmembers',
|
||||
array('nickname' => $this->group->nickname));
|
||||
|
|
|
@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php';
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class GroupqueueAction extends GroupDesignAction
|
||||
class GroupqueueAction extends GroupAction
|
||||
{
|
||||
var $page = null;
|
||||
|
||||
|
@ -132,12 +132,6 @@ class GroupqueueAction extends GroupDesignAction
|
|||
_('A list of users awaiting approval to join this group.'));
|
||||
}
|
||||
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$offset = ($this->page-1) * PROFILES_PER_PAGE;
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Show the user's hcard
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: 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/>.
|
||||
*
|
||||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* User profile page
|
||||
*
|
||||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class HcardAction extends Action
|
||||
{
|
||||
var $user;
|
||||
var $profile;
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
||||
if ($nickname_arg != $nickname) {
|
||||
$args = array('nickname' => $nickname);
|
||||
common_redirect(common_local_url('hcard', $args), 301);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->user = User::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$this->user) {
|
||||
// TRANS: Client error displayed when trying to get a user hCard for a non-existing user.
|
||||
$this->clientError(_('No such user.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->profile = $this->user->getProfile();
|
||||
|
||||
if (!$this->profile) {
|
||||
// TRANS: Error message displayed when referring to a user without a profile.
|
||||
$this->serverError(_('User has no profile.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
function title()
|
||||
{
|
||||
return $this->profile->getBestName();
|
||||
}
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$up = new ShortUserProfile($this, $this->user, $this->profile);
|
||||
$up->show();
|
||||
}
|
||||
|
||||
function showHeader()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
function showAside()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
function showSecondaryNav()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
class ShortUserProfile extends UserProfile
|
||||
{
|
||||
function showEntityActions()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -59,7 +59,13 @@ class HostMetaAction extends Action
|
|||
Event::handle('EndHostMetaLinks', array(&$xrd->links));
|
||||
}
|
||||
|
||||
// Output Cross-Origin Resource Sharing (CORS) header
|
||||
if (common_config('discovery', 'cors')) {
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
}
|
||||
|
||||
header('Content-type: application/xrd+xml');
|
||||
|
||||
print $xrd->toXML();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class ImsettingsAction extends SettingsAction
|
|||
// TRANS: [instant messages] is link text, "(%%doc.im%%)" is the link.
|
||||
// TRANS: the order and formatting of link text and link should remain unchanged.
|
||||
return _('You can send and receive notices through '.
|
||||
'instant messaging [instant messages](%%doc.im%%). '.
|
||||
'[instant messaging](%%doc.im%%). '.
|
||||
'Configure your addresses and settings below.');
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
// @todo XXX: Add documentation.
|
||||
class InviteAction extends CurrentUserDesignAction
|
||||
class InviteAction extends Action
|
||||
{
|
||||
var $mode = null;
|
||||
var $error = null;
|
||||
|
|
|
@ -131,6 +131,10 @@ class JoingroupAction extends Action
|
|||
try {
|
||||
$result = $cur->joinGroup($this->group);
|
||||
} catch (Exception $e) {
|
||||
common_log(LOG_ERR, sprintf("Couldn't join user %s to group %s: '%s'",
|
||||
$cur->nickname,
|
||||
$this->group->nickname,
|
||||
$e->getMessage()));
|
||||
// TRANS: Server error displayed when joining a group failed in the database.
|
||||
// TRANS: %1$s is the joining user's nickname, $2$s is the group nickname for which the join failed.
|
||||
$this->serverError(sprintf(_('Could not join user %1$s to group %2$s.'),
|
||||
|
|
|
@ -125,6 +125,7 @@ class LeavegroupAction extends Action
|
|||
try {
|
||||
$cur->leaveGroup($this->group);
|
||||
} catch (Exception $e) {
|
||||
common_log(LOG_ERR, "Error when {$cur->nickname} tried to leave {$this->group->nickname}: " . $e->getMessage());
|
||||
// TRANS: Server error displayed when leaving a group failed in the database.
|
||||
// TRANS: %1$s is the leaving user's nickname, $2$s is the group nickname for which the leave failed.
|
||||
$this->serverError(sprintf(_('Could not remove user %1$s from group %2$s.'),
|
||||
|
|
|
@ -94,8 +94,8 @@ class LoginAction extends Action
|
|||
parent::handle($args);
|
||||
|
||||
if (common_is_real_login()) {
|
||||
// TRANS: Client error displayed when trying to log in while already logged in.
|
||||
$this->clientError(_('Already logged in.'));
|
||||
$user = common_current_user();
|
||||
common_redirect(common_local_url('all', array('nickname' => $user->nickname)), 307);
|
||||
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$this->checkLogin();
|
||||
} else {
|
||||
|
|
|
@ -73,9 +73,15 @@ class LogoutAction extends Action
|
|||
}
|
||||
Event::handle('EndLogout', array($this));
|
||||
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$user = User::singleUser();
|
||||
common_redirect(common_local_url('showstream',
|
||||
array('nickname' => $user->nickname)));
|
||||
} else {
|
||||
common_redirect(common_local_url('public'), 303);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function logout()
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class NewApplicationAction extends OwnerDesignAction
|
||||
class NewApplicationAction extends Action
|
||||
{
|
||||
var $msg;
|
||||
|
||||
|
@ -295,6 +295,7 @@ class NewApplicationAction extends OwnerDesignAction
|
|||
$app->uploadLogo();
|
||||
} catch (Exception $e) {
|
||||
$app->query('ROLLBACK');
|
||||
// TRANS: Form validation error messages displayed when uploading an invalid application logo.
|
||||
$this->showForm(_('Invalid image.'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ class NewgroupAction extends Action
|
|||
{
|
||||
if (Event::handle('StartGroupSaveForm', array($this))) {
|
||||
try {
|
||||
$nickname = Nickname::normalize($this->trimmed('nickname'));
|
||||
$nickname = Nickname::normalize($this->trimmed('newnickname'));
|
||||
} catch (NicknameException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ class NewmessageAction extends Action
|
|||
return;
|
||||
} else if ($user->id == $this->other->id) {
|
||||
// TRANS: Client error displayed trying to send a direct message to self.
|
||||
$this->clientError(_('Don\'t send a message to yourself; ' .
|
||||
$this->clientError(_('Do not send a message to yourself; ' .
|
||||
'just say it to yourself quietly instead.'), 403);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/applicationlist.php';
|
||||
require_once INSTALLDIR . '/lib/statusnetoauthstore.php';
|
||||
|
||||
/**
|
||||
* Show a user's registered OAuth applications
|
||||
*
|
||||
|
|
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/applicationlist.php';
|
||||
require_once INSTALLDIR . '/lib/apioauthstore.php';
|
||||
require_once INSTALLDIR . '/lib/statusnetoauthstore.php';
|
||||
|
||||
/**
|
||||
* Show connected OAuth applications
|
||||
|
|
228
actions/oldschoolsettings.php
Normal file
228
actions/oldschoolsettings.php
Normal file
|
@ -0,0 +1,228 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2011, StatusNet, Inc.
|
||||
*
|
||||
* Settings panel for old-school UI
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* @category Oldschool
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Old-school settings
|
||||
*
|
||||
* @category Oldschool
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class OldschoolsettingsAction extends SettingsAction
|
||||
{
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Page title for profile settings.
|
||||
return _('Old school UI settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions for use
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Usage instructions for profile settings.
|
||||
return _('If you like it "the old way", you can set that here.');
|
||||
}
|
||||
|
||||
/**
|
||||
* For initializing members of the class.
|
||||
*
|
||||
* @param array $argarray misc. arguments
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
if (!common_config('oldschool', 'enabled')) {
|
||||
throw new ClientException("Old-school settings not enabled.");
|
||||
}
|
||||
parent::prepare($argarray);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler method
|
||||
*
|
||||
* @param array $argarray is ignored since it's now passed in in prepare()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handlePost()
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
||||
$osp = Old_school_prefs::staticGet('user_id', $user->id);
|
||||
$orig = null;
|
||||
|
||||
if (!empty($osp)) {
|
||||
$orig = clone($osp);
|
||||
} else {
|
||||
$osp = new Old_school_prefs();
|
||||
$osp->user_id = $user->id;
|
||||
$osp->created = common_sql_now();
|
||||
}
|
||||
|
||||
$osp->stream_mode_only = $this->boolean('stream_mode_only');
|
||||
$osp->conversation_tree = $this->boolean('conversation_tree');
|
||||
$osp->stream_nicknames = $this->boolean('stream_nicknames');
|
||||
$osp->modified = common_sql_now();
|
||||
|
||||
if (!empty($orig)) {
|
||||
$osp->update($orig);
|
||||
} else {
|
||||
$osp->insert();
|
||||
}
|
||||
|
||||
// TRANS: Confirmation shown when user profile settings are saved.
|
||||
$this->showForm(_('Settings saved.'), true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$user = common_current_user();
|
||||
$form = new OldSchoolForm($this, $user);
|
||||
$form->show();
|
||||
}
|
||||
}
|
||||
|
||||
class OldSchoolForm extends Form
|
||||
{
|
||||
var $user;
|
||||
|
||||
function __construct($out, $user)
|
||||
{
|
||||
parent::__construct($out);
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visible or invisible data elements
|
||||
*
|
||||
* Display the form fields that make up the data of the form.
|
||||
* Sub-classes should overload this to show their data.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formData()
|
||||
{
|
||||
$this->elementStart('fieldset');
|
||||
$this->elementStart('ul', 'form_data');
|
||||
$this->elementStart('li');
|
||||
$this->checkbox('stream_mode_only', _('Only stream mode (no conversations) in timelines'),
|
||||
$this->user->streamModeOnly());
|
||||
$this->elementEnd('li');
|
||||
$this->elementStart('li');
|
||||
$this->checkbox('conversation_tree', _('Show conversation page as hierarchical trees'),
|
||||
$this->user->conversationTree());
|
||||
$this->elementEnd('li');
|
||||
$this->elementStart('li');
|
||||
$this->checkbox('stream_nicknames', _('Show nicknames (not full names) in timelines'),
|
||||
$this->user->streamNicknames());
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('ul');
|
||||
}
|
||||
|
||||
/**
|
||||
* Buttons for form actions
|
||||
*
|
||||
* Submit and cancel buttons (or whatever)
|
||||
* Sub-classes should overload this to show their own buttons.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formActions()
|
||||
{
|
||||
$this->submit('submit', _('Save'));
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of the form
|
||||
*
|
||||
* Should be unique on the page. Sub-classes should overload this
|
||||
* to show their own IDs.
|
||||
*
|
||||
* @return int ID of the form
|
||||
*/
|
||||
|
||||
function id()
|
||||
{
|
||||
return 'form_oldschool';
|
||||
}
|
||||
|
||||
/**
|
||||
* Action of the form.
|
||||
*
|
||||
* URL to post to. Should be overloaded by subclasses to give
|
||||
* somewhere to post to.
|
||||
*
|
||||
* @return string URL to post to
|
||||
*/
|
||||
|
||||
function action()
|
||||
{
|
||||
return common_local_url('oldschoolsettings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Class of the form. May include space-separated list of multiple classes.
|
||||
*
|
||||
* @return string the form's class
|
||||
*/
|
||||
|
||||
function formClass()
|
||||
{
|
||||
return 'form_settings';
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@
|
|||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @copyright 2008-2010 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -92,7 +92,6 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||
'site' => array('path', 'locale_path', 'ssl', 'sslserver'),
|
||||
'theme' => array('server', 'dir', 'path', 'sslserver', 'sslpath'),
|
||||
'avatar' => array('server', 'dir', 'path'),
|
||||
'background' => array('server', 'dir', 'path', 'sslserver', 'sslpath'),
|
||||
'attachments' => array('server', 'dir', 'path', 'sslserver', 'sslpath')
|
||||
);
|
||||
|
||||
|
@ -163,14 +162,6 @@ class PathsadminpanelAction extends AdminPanelAction
|
|||
$this->clientError(sprintf(_('Avatar directory not writable: %s.'), $values['avatar']['dir']));
|
||||
}
|
||||
|
||||
// Validate background dir
|
||||
|
||||
if (empty($values['background']['dir']) || !is_writable($values['background']['dir'])) {
|
||||
// TRANS: Client error in Paths admin panel.
|
||||
// TRANS: %s is the background directory that could not be written to.
|
||||
$this->clientError(sprintf(_('Background directory not writable: %s.'), $values['background']['dir']));
|
||||
}
|
||||
|
||||
// Validate locales dir
|
||||
|
||||
// XXX: What else do we need to validate for lacales path here? --Z
|
||||
|
@ -364,61 +355,7 @@ class PathsAdminPanelForm extends AdminForm
|
|||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' =>
|
||||
'settings_design_background-paths'));
|
||||
// TRANS: Fieldset legend in Paths admin panel.
|
||||
$this->out->element('legend', null, _('Backgrounds'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->input('server',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('Server'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Server for backgrounds.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('path',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('Path'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Web path to backgrounds.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('sslserver',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('SSL server'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Server for backgrounds on SSL pages.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('sslpath',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('SSL path'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Web path to backgrounds on SSL pages.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('dir',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('Directory'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Directory where backgrounds are located.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' =>
|
||||
'settings_design_attachments-paths'));
|
||||
'settings_attachments-paths'));
|
||||
|
||||
// TRANS: Fieldset legens in Paths admin panel.
|
||||
$this->out->element('legend', null, _('Attachments'));
|
||||
|
@ -516,7 +453,7 @@ class PathsAdminPanelForm extends AdminForm
|
|||
// TRANS: Button text to store form data in the Paths admin panel.
|
||||
$this->out->submit('save', _m('BUTTON','Save'), 'submit',
|
||||
// TRANS: Button title text to store form data in the Paths admin panel.
|
||||
'save', _('Save paths'));
|
||||
'save', _('Save path settings.'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category Group
|
||||
* @package StatusNet
|
||||
* @author Shashi Gowda <connect2shashi@gmail.com>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class PeopletaggedAction extends OwnerDesignAction
|
||||
class PeopletaggedAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $peopletag = null;
|
||||
|
@ -58,7 +58,12 @@ class PeopletaggedAction extends OwnerDesignAction
|
|||
parent::prepare($args);
|
||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$tagger_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
}
|
||||
|
||||
$tag_arg = $this->arg('tag');
|
||||
$tagger = common_canonical_nickname($tagger_arg);
|
||||
$tag = common_canonical_tag($tag_arg);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Shashi Gowda <connect2shashi@gmail.com>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
|
||||
require_once INSTALLDIR.'/lib/peopletaglist.php';
|
||||
|
||||
class PeopletagsbyuserAction extends OwnerDesignAction
|
||||
class PeopletagsbyuserAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $tagger = null;
|
||||
|
@ -76,7 +76,12 @@ class PeopletagsbyuserAction extends OwnerDesignAction
|
|||
$this->args['public'] = $this->args['private'] = false;
|
||||
}
|
||||
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$nickname_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
}
|
||||
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
@ -213,7 +218,7 @@ class PeopletagsbyuserAction extends OwnerDesignAction
|
|||
'(http://en.wikipedia.org/wiki/Micro-blogging) service ' .
|
||||
'based on the Free Software [StatusNet](http://status.net/) tool. ' .
|
||||
'You can easily keep track of what they ' .
|
||||
'are doing by subscribing to the tag\'s timeline.' ), $this->tagger->nickname);
|
||||
'are doing by subscribing to the list\'s timeline.' ), $this->tagger->nickname);
|
||||
$this->elementStart('div', array('id' => 'anon_notice'));
|
||||
$this->raw(common_markup_to_html($notice));
|
||||
$this->elementEnd('div');
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Shashi Gowda <connect2shashi@gmail.com>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
|
||||
require_once INSTALLDIR.'/lib/peopletaglist.php';
|
||||
|
||||
class PeopletagsforuserAction extends OwnerDesignAction
|
||||
class PeopletagsforuserAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $tagged = null;
|
||||
|
@ -58,7 +58,12 @@ class PeopletagsforuserAction extends OwnerDesignAction
|
|||
{
|
||||
parent::prepare($args);
|
||||
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$nickname_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
}
|
||||
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
@ -111,7 +116,7 @@ class PeopletagsforuserAction extends OwnerDesignAction
|
|||
'(http://en.wikipedia.org/wiki/Micro-blogging) service ' .
|
||||
'based on the Free Software [StatusNet](http://status.net/) tool. ' .
|
||||
'You can easily keep track of what they ' .
|
||||
'are doing by subscribing to the tag\'s timeline.' ), $this->tagged->nickname);
|
||||
'are doing by subscribing to the list\'s timeline.' ), $this->tagged->nickname);
|
||||
$this->elementStart('div', array('id' => 'anon_notice'));
|
||||
$this->raw(common_markup_to_html($notice));
|
||||
$this->elementEnd('div');
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category Group
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class PeopletagsubscribersAction extends OwnerDesignAction
|
||||
class PeopletagsubscribersAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $peopletag = null;
|
||||
|
@ -58,7 +58,12 @@ class PeopletagsubscribersAction extends OwnerDesignAction
|
|||
parent::prepare($args);
|
||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$tagger_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
}
|
||||
|
||||
$tag_arg = $this->arg('tag');
|
||||
$tagger = common_canonical_nickname($tagger_arg);
|
||||
$tag = common_canonical_tag($tag_arg);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Shashi Gowda <connect2shashi@gmail.com>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
|
||||
require_once INSTALLDIR.'/lib/peopletaglist.php';
|
||||
|
||||
class PeopletagsubscriptionsAction extends OwnerDesignAction
|
||||
class PeopletagsubscriptionsAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $profile = null;
|
||||
|
@ -60,7 +60,12 @@ class PeopletagsubscriptionsAction extends OwnerDesignAction
|
|||
{
|
||||
parent::prepare($args);
|
||||
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$nickname_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
}
|
||||
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
|
|
@ -185,7 +185,7 @@ class ProfilesettingsAction extends SettingsAction
|
|||
$this->checkbox('autosubscribe',
|
||||
// TRANS: Checkbox label in form for profile settings.
|
||||
_('Automatically subscribe to whoever '.
|
||||
'subscribes to me (best for non-humans).'),
|
||||
'subscribes to me (best for non-humans)'),
|
||||
($this->arg('autosubscribe')) ?
|
||||
$this->boolean('autosubscribe') : $user->autosubscribe);
|
||||
$this->elementEnd('li');
|
||||
|
|
|
@ -88,14 +88,20 @@ class PublicAction extends Action
|
|||
|
||||
$this->userProfile = Profile::current();
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
if (!empty($user) && $user->streamModeOnly()) {
|
||||
$stream = new PublicNoticeStream($this->userProfile);
|
||||
} else {
|
||||
$stream = new ThreadingPublicNoticeStream($this->userProfile);
|
||||
}
|
||||
|
||||
$this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||
NOTICES_PER_PAGE + 1);
|
||||
|
||||
if (!$this->notice) {
|
||||
// TRANS: Server error displayed when a public timeline cannot be retrieved.
|
||||
$this->serverError(_('Could not retrieve public stream.'));
|
||||
$this->serverError(_('Could not retrieve public timeline.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -153,6 +159,11 @@ class PublicAction extends Action
|
|||
$this->element('link', array('rel' => 'EditURI',
|
||||
'type' => 'application/rsd+xml',
|
||||
'href' => $rsd));
|
||||
|
||||
if ($this->page != 1) {
|
||||
$this->element('link', array('rel' => 'canonical',
|
||||
'href' => common_local_url('public')));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,19 +173,24 @@ class PublicAction extends Action
|
|||
*/
|
||||
function getFeeds()
|
||||
{
|
||||
return array(new Feed(Feed::RSS1, common_local_url('publicrss'),
|
||||
return array(new Feed(Feed::JSON,
|
||||
common_local_url('ApiTimelinePublic',
|
||||
array('format' => 'as')),
|
||||
// TRANS: Link description for public timeline feed.
|
||||
_('Public Stream Feed (RSS 1.0)')),
|
||||
_('Public Timeline Feed (Activity Streams JSON)')),
|
||||
new Feed(Feed::RSS1, common_local_url('publicrss'),
|
||||
// TRANS: Link description for public timeline feed.
|
||||
_('Public Timeline Feed (RSS 1.0)')),
|
||||
new Feed(Feed::RSS2,
|
||||
common_local_url('ApiTimelinePublic',
|
||||
array('format' => 'rss')),
|
||||
// TRANS: Link description for public timeline feed.
|
||||
_('Public Stream Feed (RSS 2.0)')),
|
||||
_('Public Timeline Feed (RSS 2.0)')),
|
||||
new Feed(Feed::ATOM,
|
||||
common_local_url('ApiTimelinePublic',
|
||||
array('format' => 'atom')),
|
||||
// TRANS: Link description for public timeline feed.
|
||||
_('Public Stream Feed (Atom)')));
|
||||
_('Public Timeline Feed (Atom)')));
|
||||
}
|
||||
|
||||
function showEmptyList()
|
||||
|
@ -208,7 +224,13 @@ class PublicAction extends Action
|
|||
*/
|
||||
function showContent()
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
||||
if (!empty($user) && $user->streamModeOnly()) {
|
||||
$nl = new NoticeList($this->notice, $this);
|
||||
} else {
|
||||
$nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile);
|
||||
}
|
||||
|
||||
$cnt = $nl->show();
|
||||
|
||||
|
@ -222,12 +244,30 @@ class PublicAction extends Action
|
|||
|
||||
function showSections()
|
||||
{
|
||||
// Show invite button, as long as site isn't closed, and
|
||||
// we have a logged in user.
|
||||
if (common_config('invite', 'enabled') && !common_config('site', 'closed') && common_logged_in()) {
|
||||
if (!common_config('site', 'private')) {
|
||||
$ibs = new InviteButtonSection(
|
||||
$this,
|
||||
// TRANS: Button text for inviting more users to the StatusNet instance.
|
||||
// TRANS: Less business/enterprise-oriented language for public sites.
|
||||
_m('BUTTON', 'Send invite')
|
||||
);
|
||||
} else {
|
||||
$ibs = new InviteButtonSection($this);
|
||||
}
|
||||
$ibs->show();
|
||||
$pop = new PopularNoticeSection($this);
|
||||
}
|
||||
|
||||
$p = Profile::current();
|
||||
|
||||
$pop = new PopularNoticeSection($this, $p);
|
||||
$pop->show();
|
||||
if (!common_config('performance', 'high')) {
|
||||
$cloud = new PublicTagCloudSection($this);
|
||||
$cloud->show();
|
||||
}
|
||||
$feat = new FeaturedUsersSection($this);
|
||||
$feat->show();
|
||||
}
|
||||
|
|
|
@ -1,182 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Public tag cloud for notices
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: 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/>.
|
||||
*
|
||||
* @category Public
|
||||
* @package StatusNet
|
||||
* @author Mike Cochrane <mikec@mikenz.geek.nz>
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008 Mike Cochrane
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
define('TAGS_PER_PAGE', 100);
|
||||
|
||||
/**
|
||||
* Public tag cloud for notices
|
||||
*
|
||||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Mike Cochrane <mikec@mikenz.geek.nz>
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008 Mike Cochrane
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class PublicpeopletagcloudAction extends Action
|
||||
{
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for page with public list cloud.
|
||||
return _('Public list cloud');
|
||||
}
|
||||
|
||||
function showPageNotice()
|
||||
{
|
||||
$this->element('p', 'instructions',
|
||||
// TRANS: Page notice for page with public list cloud.
|
||||
// TRANS: %s is a StatusNet sitename.
|
||||
sprintf(_('These are largest lists on %s'),
|
||||
common_config('site', 'name')));
|
||||
}
|
||||
|
||||
function showEmptyList()
|
||||
{
|
||||
// TRANS: Empty list message on page with public list cloud.
|
||||
// TRANS: This message contains Markdown links in the form [description](link).
|
||||
$message = _('No one has [listed](%%doc.tags%%) anyone yet.') . ' ';
|
||||
|
||||
if (common_logged_in()) {
|
||||
// TRANS: Additional empty list message on page with public list cloud for logged in users.
|
||||
$message .= _('Be the first to list someone!');
|
||||
}
|
||||
else {
|
||||
// TRANS: Additional empty list message on page with public list cloud for anonymous users.
|
||||
// TRANS: This message contains Markdown links in the form [description](link).
|
||||
$message .= _('Why not [register an account](%%action.register%%) and be the first to list someone!');
|
||||
}
|
||||
|
||||
$this->elementStart('div', 'guide');
|
||||
$this->raw(common_markup_to_html($message));
|
||||
$this->elementEnd('div');
|
||||
}
|
||||
|
||||
function showLocalNav()
|
||||
{
|
||||
$nav = new PublicGroupNav($this);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
function showContent()
|
||||
{
|
||||
// XXX: cache this
|
||||
|
||||
$tags = new Profile_tag();
|
||||
$plist = new Profile_list();
|
||||
$plist->private = false;
|
||||
|
||||
$tags->joinAdd($plist);
|
||||
$tags->selectAdd();
|
||||
$tags->selectAdd('profile_tag.tag');
|
||||
$tags->selectAdd('count(profile_tag.tag) as weight');
|
||||
$tags->groupBy('profile_tag.tag');
|
||||
$tags->orderBy('weight DESC');
|
||||
|
||||
$tags->limit(TAGS_PER_PAGE);
|
||||
|
||||
$cnt = $tags->find();
|
||||
|
||||
if ($cnt > 0) {
|
||||
$this->elementStart('div', array('id' => 'tagcloud',
|
||||
'class' => 'section'));
|
||||
|
||||
$tw = array();
|
||||
$sum = 0;
|
||||
while ($tags->fetch()) {
|
||||
$tw[$tags->tag] = $tags->weight;
|
||||
$sum += $tags->weight;
|
||||
}
|
||||
|
||||
ksort($tw);
|
||||
|
||||
$this->elementStart('dl');
|
||||
// TRANS: DT element on on page with public list cloud.
|
||||
$this->element('dt', null, _('List cloud'));
|
||||
$this->elementStart('dd');
|
||||
$this->elementStart('ul', 'tags xoxo tag-cloud');
|
||||
foreach ($tw as $tag => $weight) {
|
||||
if ($sum) {
|
||||
$weightedSum = $weight/$sum;
|
||||
} else {
|
||||
$weightedSum = 0.5;
|
||||
}
|
||||
$this->showTag($tag, $weight, $weightedSum);
|
||||
}
|
||||
$this->elementEnd('ul');
|
||||
$this->elementEnd('dd');
|
||||
$this->elementEnd('dl');
|
||||
$this->elementEnd('div');
|
||||
} else {
|
||||
$this->showEmptyList();
|
||||
}
|
||||
}
|
||||
|
||||
function showTag($tag, $weight, $relative)
|
||||
{
|
||||
if ($relative > 0.1) {
|
||||
$rel = 'tag-cloud-7';
|
||||
} else if ($relative > 0.05) {
|
||||
$rel = 'tag-cloud-6';
|
||||
} else if ($relative > 0.02) {
|
||||
$rel = 'tag-cloud-5';
|
||||
} else if ($relative > 0.01) {
|
||||
$rel = 'tag-cloud-4';
|
||||
} else if ($relative > 0.005) {
|
||||
$rel = 'tag-cloud-3';
|
||||
} else if ($relative > 0.002) {
|
||||
$rel = 'tag-cloud-2';
|
||||
} else {
|
||||
$rel = 'tag-cloud-1';
|
||||
}
|
||||
|
||||
$this->elementStart('li', $rel);
|
||||
|
||||
// TRANS: Link title for number of listed people. %d is the number of listed people.
|
||||
$title = sprintf(_m('1 person listed','%d people listed',$weight),$weight);
|
||||
$this->element('a', array('href' => common_local_url('peopletag', array('tag' => $tag)),
|
||||
'title' => $title), $tag);
|
||||
$this->elementEnd('li');
|
||||
}
|
||||
}
|
|
@ -260,7 +260,7 @@ class RecoverpasswordAction extends Action
|
|||
$this->elementStart('li');
|
||||
// TRANS: Field label for password reset form where the password has to be typed again.
|
||||
$this->password('confirm', _('Confirm'),
|
||||
// TRANS: Ttile for field label for password reset form where the password has to be typed again.
|
||||
// TRANS: Title for field label for password reset form where the password has to be typed again.
|
||||
_('Same as password above.'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
|
@ -273,108 +273,25 @@ class RecoverpasswordAction extends Action
|
|||
function recoverPassword()
|
||||
{
|
||||
$nore = $this->trimmed('nicknameoremail');
|
||||
|
||||
if (!$nore) {
|
||||
// TRANS: Form instructions for password recovery form.
|
||||
$this->showForm(_('Enter a nickname or email address.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::staticGet('email', common_canonical_email($nore));
|
||||
|
||||
if (!$user) {
|
||||
try {
|
||||
$user = User::staticGet('nickname', common_canonical_nickname($nore));
|
||||
} catch (NicknameException $e) {
|
||||
// invalid
|
||||
}
|
||||
}
|
||||
|
||||
// See if it's an unconfirmed email address
|
||||
|
||||
if (!$user) {
|
||||
// Warning: it may actually be legit to have multiple folks
|
||||
// who have claimed, but not yet confirmed, the same address.
|
||||
// We'll only send to the first one that comes up.
|
||||
$confirm_email = new Confirm_address();
|
||||
$confirm_email->address = common_canonical_email($nore);
|
||||
$confirm_email->address_type = 'email';
|
||||
$confirm_email->find();
|
||||
if ($confirm_email->fetch()) {
|
||||
$user = User::staticGet($confirm_email->user_id);
|
||||
} else {
|
||||
$confirm_email = null;
|
||||
}
|
||||
} else {
|
||||
$confirm_email = null;
|
||||
}
|
||||
|
||||
if (!$user) {
|
||||
// TRANS: Information on password recovery form if no known username or e-mail address was specified.
|
||||
$this->showForm(_('No user with that email address or username.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to get an unconfirmed email address if they used a user name
|
||||
|
||||
if (!$user->email && !$confirm_email) {
|
||||
$confirm_email = new Confirm_address();
|
||||
$confirm_email->user_id = $user->id;
|
||||
$confirm_email->address_type = 'email';
|
||||
$confirm_email->find();
|
||||
if (!$confirm_email->fetch()) {
|
||||
$confirm_email = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$user->email && !$confirm_email) {
|
||||
// TRANS: Client error displayed on password recovery form if a user does not have a registered e-mail address.
|
||||
$this->clientError(_('No registered email address for that user.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Success! We have a valid user and a confirmed or unconfirmed email address
|
||||
|
||||
$confirm = new Confirm_address();
|
||||
$confirm->code = common_confirmation_code(128);
|
||||
$confirm->address_type = 'recover';
|
||||
$confirm->user_id = $user->id;
|
||||
$confirm->address = (!empty($user->email)) ? $user->email : $confirm_email->address;
|
||||
|
||||
if (!$confirm->insert()) {
|
||||
common_log_db_error($confirm, 'INSERT', __FILE__);
|
||||
// TRANS: Server error displayed if e-mail address confirmation fails in the database on the password recovery form.
|
||||
$this->serverError(_('Error saving address confirmation.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// @todo FIXME: needs i18n.
|
||||
$body = "Hey, $user->nickname.";
|
||||
$body .= "\n\n";
|
||||
$body .= 'Someone just asked for a new password ' .
|
||||
'for this account on ' . common_config('site', 'name') . '.';
|
||||
$body .= "\n\n";
|
||||
$body .= 'If it was you, and you want to confirm, use the URL below:';
|
||||
$body .= "\n\n";
|
||||
$body .= "\t".common_local_url('recoverpassword',
|
||||
array('code' => $confirm->code));
|
||||
$body .= "\n\n";
|
||||
$body .= 'If not, just ignore this message.';
|
||||
$body .= "\n\n";
|
||||
$body .= 'Thanks for your time, ';
|
||||
$body .= "\n";
|
||||
$body .= common_config('site', 'name');
|
||||
$body .= "\n";
|
||||
|
||||
$headers = _mail_prepare_headers('recoverpassword', $user->nickname, $user->nickname);
|
||||
// TRANS: Subject for password recovery e-mail.
|
||||
mail_to_user($user, _('Password recovery requested'), $body, $headers, $confirm->address);
|
||||
|
||||
User::recoverPassword($nore);
|
||||
$this->mode = 'sent';
|
||||
// TRANS: User notification after an e-mail with instructions was sent from the password recovery form.
|
||||
$this->msg = _('Instructions for recovering your password ' .
|
||||
'have been sent to the email address registered to your ' .
|
||||
'account.');
|
||||
$this->success = true;
|
||||
} catch (Exception $e) {
|
||||
$this->success = false;
|
||||
$this->msg = $e->getMessage();
|
||||
}
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
|
|
|
@ -112,18 +112,6 @@ class RemovepeopletagAction extends Action
|
|||
return false;
|
||||
}
|
||||
|
||||
// OMB 0.1 doesn't have a mechanism for local-server-
|
||||
// originated tag.
|
||||
|
||||
$omb01 = Remote_profile::staticGet('id', $tagged_id);
|
||||
|
||||
if (!empty($omb01)) {
|
||||
// TRANS: Client error displayed when trying to (un)list an OMB 0.1 remote profile.
|
||||
$this->clientError(_('You cannot (un)list an OMB 0.1 '.
|
||||
'remote profile with this action.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class RepliesAction extends OwnerDesignAction
|
||||
class RepliesAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $notice;
|
||||
|
@ -85,7 +85,10 @@ class RepliesAction extends OwnerDesignAction
|
|||
|
||||
common_set_returnto($this->selfUrl());
|
||||
|
||||
$this->notice = $this->user->getReplies(($this->page-1) * NOTICES_PER_PAGE,
|
||||
$stream = new ReplyNoticeStream($this->user->id,
|
||||
Profile::current());
|
||||
|
||||
$this->notice = $stream->getNotices(($this->page-1) * NOTICES_PER_PAGE,
|
||||
NOTICES_PER_PAGE + 1);
|
||||
|
||||
if($this->page > 1 && $this->notice->N == 0){
|
||||
|
@ -140,7 +143,16 @@ class RepliesAction extends OwnerDesignAction
|
|||
*/
|
||||
function getFeeds()
|
||||
{
|
||||
return array(new Feed(Feed::RSS1,
|
||||
return array(new Feed(Feed::JSON,
|
||||
common_local_url('ApiTimelineMentions',
|
||||
array(
|
||||
'id' => $this->user->nickname,
|
||||
'format' => 'as')),
|
||||
// TRANS: Link for feed with replies for a user.
|
||||
// TRANS: %s is a user nickname.
|
||||
sprintf(_('Replies feed for %s (Activity Streams JSON)'),
|
||||
$this->user->nickname)),
|
||||
new Feed(Feed::RSS1,
|
||||
common_local_url('repliesrss',
|
||||
array('nickname' => $this->user->nickname)),
|
||||
// TRANS: Link for feed with replies for a user.
|
||||
|
|
|
@ -339,7 +339,7 @@ class RestoreAccountForm extends Form
|
|||
$this->out->elementStart('p', 'instructions');
|
||||
|
||||
// TRANS: Form instructions for feed restore.
|
||||
$this->out->raw(_('You can upload a backed-up stream in '.
|
||||
$this->out->raw(_('You can upload a backed-up timeline in '.
|
||||
'<a href="http://activitystrea.ms/">Activity Streams</a> format.'));
|
||||
|
||||
$this->out->elementEnd('p');
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category Application
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ShowApplicationAction extends OwnerDesignAction
|
||||
class ShowApplicationAction extends Action
|
||||
{
|
||||
/**
|
||||
* Application to show
|
||||
|
@ -251,21 +251,24 @@ class ShowApplicationAction extends OwnerDesignAction
|
|||
$this->elementStart('div', 'entity_data');
|
||||
// TRANS: Header on the OAuth application page.
|
||||
$this->element('h2', null, _('Application info'));
|
||||
$this->element('div',
|
||||
'entity_consumer_key',
|
||||
$consumer->consumer_key);
|
||||
|
||||
$this->element('div',
|
||||
'entity_consumer_secret',
|
||||
$consumer->consumer_secret);
|
||||
|
||||
$this->element('div',
|
||||
'entity_request_token_url',
|
||||
common_local_url('ApiOauthRequestToken'));
|
||||
|
||||
$this->element('div', 'entity_access_token_url', common_local_url('ApiOauthAccessToken'));
|
||||
|
||||
$this->element('div', 'entity_authorize_url', common_local_url('ApiOauthAuthorize'));
|
||||
$this->elementStart('dl');
|
||||
// TRANS: Field label on application page.
|
||||
$this->element('dt', null, _('Consumer key'));
|
||||
$this->element('dd', null, $consumer->consumer_key);
|
||||
// TRANS: Field label on application page.
|
||||
$this->element('dt', null, _('Consumer secret'));
|
||||
$this->element('dd', null, $consumer->consumer_secret);
|
||||
// TRANS: Field label on application page.
|
||||
$this->element('dt', null, _('Request token URL'));
|
||||
$this->element('dd', null, common_local_url('ApiOauthRequestToken'));
|
||||
// TRANS: Field label on application page.
|
||||
$this->element('dt', null, _('Access token URL'));
|
||||
$this->element('dd', null, common_local_url('ApiOauthAccessToken'));
|
||||
// TRANS: Field label on application page.
|
||||
$this->element('dt', null, _('Authorize URL'));
|
||||
$this->element('dd', null, common_local_url('ApiOauthAuthorize'));
|
||||
$this->elementEnd('dl');
|
||||
|
||||
$this->element('p', 'note',
|
||||
// TRANS: Note on the OAuth application page about signature support.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ShowfavoritesAction extends OwnerDesignAction
|
||||
class ShowfavoritesAction extends Action
|
||||
{
|
||||
/** User we're getting the faves of */
|
||||
var $user = null;
|
||||
|
@ -165,7 +165,15 @@ class ShowfavoritesAction extends OwnerDesignAction
|
|||
*/
|
||||
function getFeeds()
|
||||
{
|
||||
return array(new Feed(Feed::RSS1,
|
||||
return array(new Feed(Feed::JSON,
|
||||
common_local_url('ApiTimelineFavorites',
|
||||
array(
|
||||
'id' => $this->user->nickname,
|
||||
'format' => 'as')),
|
||||
// TRANS: Feed link text. %s is a username.
|
||||
sprintf(_('Feed for favorites of %s (Activity Streams JSON)'),
|
||||
$this->user->nickname)),
|
||||
new Feed(Feed::RSS1,
|
||||
common_local_url('favoritesrss',
|
||||
array('nickname' => $this->user->nickname)),
|
||||
// TRANS: Feed link text. %s is a username.
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -35,8 +35,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
require_once INSTALLDIR.'/lib/noticelist.php';
|
||||
require_once INSTALLDIR.'/lib/feedlist.php';
|
||||
|
||||
define('MEMBERS_PER_SECTION', 27);
|
||||
|
||||
/**
|
||||
* Group main page
|
||||
*
|
||||
|
@ -46,7 +44,7 @@ define('MEMBERS_PER_SECTION', 27);
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ShowgroupAction extends GroupDesignAction
|
||||
class ShowgroupAction extends GroupAction
|
||||
{
|
||||
/** page we're viewing. */
|
||||
var $page = null;
|
||||
|
@ -99,56 +97,15 @@ class ShowgroupAction extends GroupDesignAction
|
|||
|
||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
$nickname = common_canonical_nickname($nickname_arg);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
||||
if ($nickname_arg != $nickname) {
|
||||
$args = array('nickname' => $nickname);
|
||||
if ($this->page != 1) {
|
||||
$args['page'] = $this->page;
|
||||
}
|
||||
common_redirect(common_local_url('showgroup', $args), 301);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
// TRANS: Client error displayed if no nickname argument was given requesting a group page.
|
||||
$this->clientError(_('No nickname.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$local = Local_group::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$local) {
|
||||
$alias = Group_alias::staticGet('alias', $nickname);
|
||||
if ($alias) {
|
||||
$args = array('id' => $alias->group_id);
|
||||
if ($this->page != 1) {
|
||||
$args['page'] = $this->page;
|
||||
}
|
||||
common_redirect(common_local_url('groupbyid', $args), 301);
|
||||
return false;
|
||||
} else {
|
||||
common_log(LOG_NOTICE, "Couldn't find local group for nickname '$nickname'");
|
||||
// TRANS: Client error displayed if no remote group with a given name was found requesting group page.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->group = User_group::staticGet('id', $local->group_id);
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed if no local group with a given name was found requesting group page.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->userProfile = Profile::current();
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
if (!empty($user) && $user->streamModeOnly()) {
|
||||
$stream = new GroupNoticeStream($this->group, $this->userProfile);
|
||||
} else {
|
||||
$stream = new ThreadingGroupNoticeStream($this->group, $this->userProfile);
|
||||
}
|
||||
|
||||
$this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||
NOTICES_PER_PAGE + 1);
|
||||
|
@ -171,17 +128,6 @@ class ShowgroupAction extends GroupDesignAction
|
|||
$this->showPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Local menu
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the page content
|
||||
*
|
||||
|
@ -199,7 +145,14 @@ class ShowgroupAction extends GroupDesignAction
|
|||
*/
|
||||
function showGroupNotices()
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
||||
if (!empty($user) && $user->streamModeOnly()) {
|
||||
$nl = new NoticeList($this->notice, $this);
|
||||
} else {
|
||||
$nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile);
|
||||
}
|
||||
|
||||
$cnt = $nl->show();
|
||||
|
||||
$this->pagination($this->page > 1,
|
||||
|
@ -220,7 +173,14 @@ class ShowgroupAction extends GroupDesignAction
|
|||
common_local_url('grouprss',
|
||||
array('nickname' => $this->group->nickname));
|
||||
|
||||
return array(new Feed(Feed::RSS1,
|
||||
return array(new Feed(Feed::JSON,
|
||||
common_local_url('ApiTimelineGroup',
|
||||
array('format' => 'as',
|
||||
'id' => $this->group->id)),
|
||||
// TRANS: Tooltip for feed link. %s is a group nickname.
|
||||
sprintf(_('Notice feed for %s group (Activity Streams JSON)'),
|
||||
$this->group->nickname)),
|
||||
new Feed(Feed::RSS1,
|
||||
common_local_url('grouprss',
|
||||
array('nickname' => $this->group->nickname)),
|
||||
// TRANS: Tooltip for feed link. %s is a group nickname.
|
||||
|
@ -248,201 +208,37 @@ class ShowgroupAction extends GroupDesignAction
|
|||
$this->group->nickname)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill in the sidebar.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showSections()
|
||||
{
|
||||
$this->showMembers();
|
||||
$this->showStatistics();
|
||||
$this->showAdmins();
|
||||
$cloud = new GroupTagCloudSection($this, $this->group);
|
||||
$cloud->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show mini-list of members
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showMembers()
|
||||
{
|
||||
$member = $this->group->getMembers(0, MEMBERS_PER_SECTION);
|
||||
|
||||
if (!$member) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->elementStart('div', array('id' => 'entity_members',
|
||||
'class' => 'section'));
|
||||
|
||||
if (Event::handle('StartShowGroupMembersMiniList', array($this))) {
|
||||
|
||||
// TRANS: Header for mini list of group members on a group page (h2).
|
||||
$this->element('h2', null, _('Members'));
|
||||
|
||||
$gmml = new GroupMembersMiniList($member, $this);
|
||||
$cnt = $gmml->show();
|
||||
if ($cnt == 0) {
|
||||
// TRANS: Description for mini list of group members on a group page when the group has no members.
|
||||
$this->element('p', null, _('(None)'));
|
||||
}
|
||||
|
||||
// @todo FIXME: Should be shown if a group has more than 27 members, but I do not see it displayed at
|
||||
// for example http://identi.ca/group/statusnet. Broken?
|
||||
if ($cnt > MEMBERS_PER_SECTION) {
|
||||
$this->element('a', array('href' => common_local_url('groupmembers',
|
||||
array('nickname' => $this->group->nickname))),
|
||||
// TRANS: Link to all group members from mini list of group members if group has more than n members.
|
||||
_('All members'));
|
||||
}
|
||||
|
||||
Event::handle('EndShowGroupMembersMiniList', array($this));
|
||||
}
|
||||
|
||||
$this->elementEnd('div');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of admins
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showAdmins()
|
||||
{
|
||||
$adminSection = new GroupAdminSection($this, $this->group);
|
||||
$adminSection->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show some statistics
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showStatistics()
|
||||
{
|
||||
$this->elementStart('div', array('id' => 'entity_statistics',
|
||||
'class' => 'section'));
|
||||
|
||||
// TRANS: Header for group statistics on a group page (h2).
|
||||
$this->element('h2', null, _('Statistics'));
|
||||
|
||||
$this->elementStart('dl');
|
||||
|
||||
// TRANS: Label for group creation date.
|
||||
$this->element('dt', null, _m('LABEL','Created'));
|
||||
$this->element('dd', 'entity_created', date('j M Y',
|
||||
strtotime($this->group->created)));
|
||||
// @todo FIXME: i18n issue. This label gets a colon added from somewhere. Should be part of the message.
|
||||
// TRANS: Label for member count in statistics on group page.
|
||||
$this->element('dt', null, _m('LABEL','Members'));
|
||||
$this->element('dd', null, $this->group->getMemberCount());
|
||||
$this->elementEnd('dl');
|
||||
|
||||
$this->elementEnd('div');
|
||||
}
|
||||
|
||||
function showAnonymousMessage()
|
||||
{
|
||||
if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
|
||||
// @todo FIXME: use group full name here if available instead of (uglier) primary alias.
|
||||
// TRANS: Notice on group pages for anonymous users for StatusNet sites that accept new registrations.
|
||||
// TRANS: **%s** is the group alias, %%%%site.name%%%% is the site name,
|
||||
// TRANS: %s is the group name, %%%%site.name%%%% is the site name,
|
||||
// TRANS: %%%%action.register%%%% is the URL for registration, %%%%doc.help%%%% is a URL to help.
|
||||
// TRANS: This message contains Markdown links. Ensure they are formatted correctly: [Description](link).
|
||||
$m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
|
||||
'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' .
|
||||
'short messages about their life and interests. '.
|
||||
'[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'),
|
||||
$this->group->nickname);
|
||||
$this->group->getBestName());
|
||||
} else {
|
||||
// @todo FIXME: use group full name here if available instead of (uglier) primary alias.
|
||||
// TRANS: Notice on group pages for anonymous users for StatusNet sites that accept no new registrations.
|
||||
// TRANS: **%s** is the group alias, %%%%site.name%%%% is the site name,
|
||||
// TRANS: %s is the group name, %%%%site.name%%%% is the site name,
|
||||
// TRANS: This message contains Markdown links. Ensure they are formatted correctly: [Description](link).
|
||||
$m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
|
||||
'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' .
|
||||
'short messages about their life and interests. '),
|
||||
$this->group->nickname);
|
||||
'short messages about their life and interests.'),
|
||||
$this->group->getBestName());
|
||||
}
|
||||
$this->elementStart('div', array('id' => 'anon_notice'));
|
||||
$this->raw(common_markup_to_html($m));
|
||||
$this->elementEnd('div');
|
||||
}
|
||||
|
||||
function noticeFormOptions()
|
||||
function extraHead()
|
||||
{
|
||||
$options = parent::noticeFormOptions();
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!empty($cur) && $cur->isMember($this->group)) {
|
||||
$options['to_group'] = $this->group;
|
||||
if ($this->page != 1) {
|
||||
$this->element('link', array('rel' => 'canonical',
|
||||
'href' => $this->group->homeUrl()));
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupAdminSection extends ProfileSection
|
||||
{
|
||||
var $group;
|
||||
|
||||
function __construct($out, $group)
|
||||
{
|
||||
parent::__construct($out);
|
||||
$this->group = $group;
|
||||
}
|
||||
|
||||
function getProfiles()
|
||||
{
|
||||
return $this->group->getAdmins();
|
||||
}
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for list of group administrators on a group page.
|
||||
return _m('TITLE','Admins');
|
||||
}
|
||||
|
||||
function divId()
|
||||
{
|
||||
return 'group_admins';
|
||||
}
|
||||
|
||||
function moreUrl()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupMembersMiniList extends ProfileMiniList
|
||||
{
|
||||
function newListItem($profile)
|
||||
{
|
||||
return new GroupMembersMiniListItem($profile, $this->action);
|
||||
}
|
||||
}
|
||||
|
||||
class GroupMembersMiniListItem extends ProfileMiniListItem
|
||||
{
|
||||
function linkAttributes()
|
||||
{
|
||||
$aAttrs = parent::linkAttributes();
|
||||
|
||||
if (common_config('nofollow', 'members')) {
|
||||
$aAttrs['rel'] .= ' nofollow';
|
||||
}
|
||||
|
||||
return $aAttrs;
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadingGroupNoticeStream extends ThreadingNoticeStream
|
||||
{
|
||||
function __construct($group, $profile)
|
||||
{
|
||||
parent::__construct(new GroupNoticeStream($group, $profile));
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ShownoticeAction extends OwnerDesignAction
|
||||
class ShownoticeAction extends Action
|
||||
{
|
||||
/**
|
||||
* Notice object to show
|
||||
|
@ -214,7 +214,7 @@ class ShownoticeAction extends OwnerDesignAction
|
|||
if ($this->boolean('ajax')) {
|
||||
$this->showAjax();
|
||||
} else {
|
||||
if ($this->notice->is_local == Notice::REMOTE_OMB) {
|
||||
if ($this->notice->is_local == Notice::REMOTE) {
|
||||
if (!empty($this->notice->url)) {
|
||||
$target = $this->notice->url;
|
||||
} else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) {
|
||||
|
|
|
@ -44,7 +44,11 @@ class ShowprofiletagAction extends Action
|
|||
{
|
||||
parent::prepare($args);
|
||||
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$tagger_arg = User::singleUserNickname();
|
||||
} else {
|
||||
$tagger_arg = $this->arg('tagger');
|
||||
}
|
||||
$tag_arg = $this->arg('tag');
|
||||
$tagger = common_canonical_nickname($tagger_arg);
|
||||
$tag = common_canonical_tag($tag_arg);
|
||||
|
@ -169,7 +173,18 @@ class ShowprofiletagAction extends Action
|
|||
function getFeeds()
|
||||
{
|
||||
#XXX: make these actually work
|
||||
return array(new Feed(Feed::RSS2,
|
||||
return array(new Feed(Feed::JSON,
|
||||
common_local_url(
|
||||
'ApiTimelineList', array(
|
||||
'user' => $this->tagger->id,
|
||||
'id' => $this->peopletag->id,
|
||||
'format' => 'as'
|
||||
)
|
||||
),
|
||||
// TRANS: Feed title.
|
||||
// TRANS: %s is tagger's nickname.
|
||||
sprintf(_('Feed for friends of %s (Activity Streams JSON)'), $this->tagger->nickname)),
|
||||
new Feed(Feed::RSS2,
|
||||
common_local_url(
|
||||
'ApiTimelineList', array(
|
||||
'user' => $this->tagger->id,
|
||||
|
@ -339,17 +354,7 @@ class ShowprofiletagAction extends Action
|
|||
}
|
||||
}
|
||||
|
||||
if ($cnt > PROFILES_PER_MINILIST) {
|
||||
$this->elementStart('p');
|
||||
$this->element('a', array('href' => common_local_url('profiletagsubscribers',
|
||||
array('nickname' => $this->tagger->nickname,
|
||||
'profiletag' => $this->peopletag->tag)),
|
||||
'class' => 'more'),
|
||||
// TRANS: Link for more "People following tag x"
|
||||
// TRANS: if there are more than the mini list's maximum.
|
||||
_('All subscribers'));
|
||||
$this->elementEnd('p');
|
||||
}
|
||||
// FIXME: link to full list
|
||||
|
||||
Event::handle('EndShowProfileTagSubscribersMiniList', array($this));
|
||||
}
|
||||
|
|
|
@ -55,6 +55,25 @@ require_once INSTALLDIR.'/lib/feedlist.php';
|
|||
*/
|
||||
class ShowstreamAction extends ProfileAction
|
||||
{
|
||||
var $notice;
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$p = Profile::current();
|
||||
|
||||
if (empty($this->tag)) {
|
||||
$stream = new ProfileNoticeStream($this->profile, $p);
|
||||
} else {
|
||||
$stream = new TaggedProfileNoticeStream($this->profile, $this->tag, $p);
|
||||
}
|
||||
|
||||
$this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
|
@ -65,11 +84,11 @@ class ShowstreamAction extends ProfileAction
|
|||
$base = $this->profile->getFancyName();
|
||||
if (!empty($this->tag)) {
|
||||
if ($this->page == 1) {
|
||||
// TRANS: Page title showing tagged notices in one user's stream.
|
||||
// TRANS: Page title showing tagged notices in one user's timeline.
|
||||
// TRANS: %1$s is the username, %2$s is the hash tag.
|
||||
return sprintf(_('Notices by %1$s tagged %2$s'), $base, $this->tag);
|
||||
} else {
|
||||
// TRANS: Page title showing tagged notices in one user's stream.
|
||||
// TRANS: Page title showing tagged notices in one user's timeline.
|
||||
// TRANS: %1$s is the username, %2$s is the hash tag, %3$d is the page number.
|
||||
return sprintf(_('Notices by %1$s tagged %2$s, page %3$d'), $base, $this->tag, $this->page);
|
||||
}
|
||||
|
@ -77,7 +96,7 @@ class ShowstreamAction extends ProfileAction
|
|||
if ($this->page == 1) {
|
||||
return $base;
|
||||
} else {
|
||||
// TRANS: Extended page title showing tagged notices in one user's stream.
|
||||
// TRANS: Extended page title showing tagged notices in one user's timeline.
|
||||
// TRANS: %1$s is the username, %2$d is the page number.
|
||||
return sprintf(_('Notices by %1$s, page %2$d'),
|
||||
$base,
|
||||
|
@ -92,9 +111,6 @@ class ShowstreamAction extends ProfileAction
|
|||
|
||||
// For YADIS discovery, we also have a <meta> tag
|
||||
|
||||
header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' =>
|
||||
$this->user->nickname)));
|
||||
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
|
@ -127,7 +143,16 @@ class ShowstreamAction extends ProfileAction
|
|||
$this->user->nickname, $this->tag)));
|
||||
}
|
||||
|
||||
return array(new Feed(Feed::RSS1,
|
||||
return array(new Feed(Feed::JSON,
|
||||
common_local_url('ApiTimelineUser',
|
||||
array(
|
||||
'id' => $this->user->id,
|
||||
'format' => 'as')),
|
||||
// TRANS: Title for link to notice feed.
|
||||
// TRANS: %s is a user nickname.
|
||||
sprintf(_('Notice feed for %s (Activity Streams JSON)'),
|
||||
$this->user->nickname)),
|
||||
new Feed(Feed::RSS1,
|
||||
common_local_url('userrss',
|
||||
array('nickname' => $this->user->nickname)),
|
||||
// TRANS: Title for link to notice feed.
|
||||
|
@ -162,11 +187,6 @@ class ShowstreamAction extends ProfileAction
|
|||
|
||||
function extraHead()
|
||||
{
|
||||
// for remote subscriptions etc.
|
||||
$this->element('meta', array('http-equiv' => 'X-XRDS-Location',
|
||||
'content' => common_local_url('xrds', array('nickname' =>
|
||||
$this->user->nickname))));
|
||||
|
||||
if ($this->profile->bio) {
|
||||
$this->element('meta', array('name' => 'description',
|
||||
'content' => $this->profile->bio));
|
||||
|
@ -192,11 +212,16 @@ class ShowstreamAction extends ProfileAction
|
|||
$this->element('link', array('rel' => 'EditURI',
|
||||
'type' => 'application/rsd+xml',
|
||||
'href' => $rsd));
|
||||
|
||||
if ($this->page != 1) {
|
||||
$this->element('link', array('rel' => 'canonical',
|
||||
'href' => $this->profile->profileurl));
|
||||
}
|
||||
}
|
||||
|
||||
function showEmptyListMessage()
|
||||
{
|
||||
// TRANS: First sentence of empty list message for a stream. $1%s is a user nickname.
|
||||
// TRANS: First sentence of empty list message for a timeline. $1%s is a user nickname.
|
||||
$message = sprintf(_('This is the timeline for %1$s, but %1$s hasn\'t posted anything yet.'), $this->user->nickname) . ' ';
|
||||
|
||||
if (common_logged_in()) {
|
||||
|
@ -205,7 +230,7 @@ class ShowstreamAction extends ProfileAction
|
|||
// TRANS: Second sentence of empty list message for a stream for the user themselves.
|
||||
$message .= _('Seen anything interesting recently? You haven\'t posted any notices yet, now would be a good time to start :)');
|
||||
} else {
|
||||
// TRANS: Second sentence of empty list message for a non-self stream. %1$s is a user nickname, %2$s is a part of a URL.
|
||||
// TRANS: Second sentence of empty list message for a non-self timeline. %1$s is a user nickname, %2$s is a part of a URL.
|
||||
// TRANS: This message contains a Markdown link. Keep "](" together.
|
||||
$message .= sprintf(_('You can try to nudge %1$s or [post something to them](%%%%action.newnotice%%%%?status_textarea=%2$s).'), $this->user->nickname, '@' . $this->user->nickname);
|
||||
}
|
||||
|
@ -223,13 +248,9 @@ class ShowstreamAction extends ProfileAction
|
|||
|
||||
function showNotices()
|
||||
{
|
||||
$notice = empty($this->tag)
|
||||
? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
|
||||
: $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null);
|
||||
|
||||
$pnl = null;
|
||||
if (Event::handle('ShowStreamNoticeList', array($notice, $this, &$pnl))) {
|
||||
$pnl = new ProfileNoticeList($notice, $this);
|
||||
if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) {
|
||||
$pnl = new ProfileNoticeList($this->notice, $this);
|
||||
}
|
||||
$cnt = $pnl->show();
|
||||
if (0 == $cnt) {
|
||||
|
@ -248,17 +269,17 @@ class ShowstreamAction extends ProfileAction
|
|||
function showAnonymousMessage()
|
||||
{
|
||||
if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
|
||||
// TRANS: Announcement for anonymous users showing a stream if site registrations are open.
|
||||
// TRANS: Announcement for anonymous users showing a timeline if site registrations are open.
|
||||
// TRANS: This message contains a Markdown link. Keep "](" together.
|
||||
$m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
|
||||
'based on the Free Software [StatusNet](http://status.net/) tool. ' .
|
||||
'[Join now](%%%%action.register%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'),
|
||||
$this->user->nickname, $this->user->nickname);
|
||||
} else {
|
||||
// TRANS: Announcement for anonymous users showing a stream if site registrations are closed or invite only.
|
||||
// TRANS: Announcement for anonymous users showing a timeline if site registrations are closed or invite only.
|
||||
// TRANS: This message contains a Markdown link. Keep "](" together.
|
||||
$m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
|
||||
'based on the Free Software [StatusNet](http://status.net/) tool. '),
|
||||
'based on the Free Software [StatusNet](http://status.net/) tool.'),
|
||||
$this->user->nickname, $this->user->nickname);
|
||||
}
|
||||
$this->elementStart('div', array('id' => 'anon_notice'));
|
||||
|
@ -269,9 +290,11 @@ class ShowstreamAction extends ProfileAction
|
|||
function showSections()
|
||||
{
|
||||
parent::showSections();
|
||||
if (!common_config('performance', 'high')) {
|
||||
$cloud = new PersonalTagCloudSection($this, $this->user);
|
||||
$cloud->show();
|
||||
}
|
||||
}
|
||||
|
||||
function noticeFormOptions()
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @copyright 2008-2010 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -88,9 +88,19 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||
function saveSettings()
|
||||
{
|
||||
static $settings = array(
|
||||
'site' => array('name', 'broughtby', 'broughtbyurl',
|
||||
'email', 'timezone', 'language',
|
||||
'site', 'textlimit', 'dupelimit'),
|
||||
'site' => array(
|
||||
'name',
|
||||
'broughtby',
|
||||
'broughtbyurl',
|
||||
'email',
|
||||
'timezone',
|
||||
'language',
|
||||
'site',
|
||||
'textlimit',
|
||||
'dupelimit',
|
||||
'logo',
|
||||
'ssllogo'
|
||||
)
|
||||
);
|
||||
|
||||
$values = array();
|
||||
|
@ -144,6 +154,19 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||
$this->clientError(_('Not a valid email address.'));
|
||||
}
|
||||
|
||||
// Validate logos
|
||||
if (!empty($values['site']['logo']) &&
|
||||
!Validate::uri($values['site']['logo'], array('allowed_schemes' => array('http', 'https')))) {
|
||||
// TRANS: Client error displayed when a logo URL is not valid.
|
||||
$this->clientError(_('Invalid logo URL.'));
|
||||
}
|
||||
|
||||
if (!empty($values['site']['ssllogo']) &&
|
||||
!Validate::uri($values['site']['ssllogo'], array('allowed_schemes' => array('https')))) {
|
||||
// TRANS: Client error displayed when a SSL logo URL is invalid.
|
||||
$this->clientError(_('Invalid SSL logo URL.'));
|
||||
}
|
||||
|
||||
// Validate timezone
|
||||
|
||||
if (is_null($values['site']['timezone']) ||
|
||||
|
@ -173,7 +196,7 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||
|
||||
if (!Validate::number($values['site']['dupelimit'], array('min' => 1))) {
|
||||
// TRANS: Client error displayed trying to save site settings with a text limit below 1.
|
||||
$this->clientError(_("Dupe limit must be one or more seconds."));
|
||||
$this->clientError(_('Dupe limit must be one or more seconds.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,6 +274,8 @@ class SiteAdminPanelForm extends AdminForm
|
|||
$this->out->elementEnd('ul');
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->showLogo();
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_local'));
|
||||
// TRANS: Fieldset legend on site settings panel.
|
||||
$this->out->element('legend', null, _m('LEGEND','Local'));
|
||||
|
@ -277,7 +302,7 @@ class SiteAdminPanelForm extends AdminForm
|
|||
_('Default language'),
|
||||
get_nice_language_list(),
|
||||
// TRANS: Dropdown title on site settings panel.
|
||||
_('Site language when autodetection from browser settings is not available'),
|
||||
_('The site language when autodetection from browser settings is not available.'),
|
||||
false, $this->value('language'));
|
||||
$this->unli();
|
||||
|
||||
|
@ -307,6 +332,35 @@ class SiteAdminPanelForm extends AdminForm
|
|||
$this->out->elementEnd('fieldset');
|
||||
}
|
||||
|
||||
function showLogo()
|
||||
{
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_site_logo'));
|
||||
// TRANS: Fieldset legend for form to change logo.
|
||||
$this->out->element('legend', null, _('Logo'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->input('logo',
|
||||
// TRANS: Field label for StatusNet site logo.
|
||||
_('Site logo'),
|
||||
// TRANS: Title for field label for StatusNet site logo.
|
||||
'Logo for the site (full URL).');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('ssllogo',
|
||||
// TRANS: Field label for SSL StatusNet site logo.
|
||||
_('SSL logo'),
|
||||
// TRANS: Title for field label for SSL StatusNet site logo.
|
||||
'Logo to show on SSL pages (full URL).');
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
}
|
||||
|
||||
/**
|
||||
* Action elements
|
||||
*
|
||||
|
@ -320,6 +374,6 @@ class SiteAdminPanelForm extends AdminForm
|
|||
'submit',
|
||||
null,
|
||||
// TRANS: Button title for saving site settings.
|
||||
_('Save site settings'));
|
||||
_('Save the site settings.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ class SiteNoticeAdminPanelForm extends AdminForm
|
|||
_m('BUTTON','Save'),
|
||||
'submit',
|
||||
null,
|
||||
// TRANS: Title for button to save site notice in admin panel.
|
||||
// TRANS: Button title to save site notice in admin panel.
|
||||
_('Save site notice.')
|
||||
);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ class SnapshotAdminPanelForm extends AdminForm
|
|||
_m('BUTTON','Save'),
|
||||
'submit',
|
||||
null,
|
||||
// TRANS: Title for button to save snapshot settings.
|
||||
// TRANS: Button title to save snapshot settings.
|
||||
_('Save snapshot settings.')
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2008-2010, StatusNet, Inc.
|
||||
* Copyright (C) 2008-2011, StatusNet, Inc.
|
||||
*
|
||||
* Subscription action.
|
||||
*
|
||||
|
@ -111,18 +111,6 @@ class SubscribeAction extends Action
|
|||
return false;
|
||||
}
|
||||
|
||||
// OMB 0.1 doesn't have a mechanism for local-server-
|
||||
// originated subscription.
|
||||
|
||||
$omb01 = Remote_profile::staticGet('id', $other_id);
|
||||
|
||||
if (!empty($omb01)) {
|
||||
// TRANS: Client error displayed trying to subscribe to an OMB 0.1 remote profile.
|
||||
$this->clientError(_('You cannot subscribe to an OMB 0.1'.
|
||||
' remote profile with this action.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -132,9 +132,7 @@ class SubscriptionsAction extends GalleryAction
|
|||
// TRANS: and do not change the URL part.
|
||||
$message = _('You\'re not listening to anyone\'s notices right now, try subscribing to people you know. '.
|
||||
'Try [people search](%%action.peoplesearch%%), look for members in groups you\'re interested '.
|
||||
'in and in our [featured users](%%action.featured%%). '.
|
||||
'If you\'re a [Twitter user](%%action.twittersettings%%), you can automatically subscribe to '.
|
||||
'people you already follow there.');
|
||||
'in and in our [featured users](%%action.featured%%).');
|
||||
} else {
|
||||
// TRANS: Subscription list text when looking at the subscriptions for a of a user other
|
||||
// TRANS: than the logged in user that has no subscriptions. %s is the user nickname.
|
||||
|
|
|
@ -23,6 +23,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
|||
class TagAction extends Action
|
||||
{
|
||||
var $notice;
|
||||
var $tag;
|
||||
var $page;
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
|
@ -79,7 +81,15 @@ class TagAction extends Action
|
|||
|
||||
function getFeeds()
|
||||
{
|
||||
return array(new Feed(Feed::RSS1,
|
||||
return array(new Feed(Feed::JSON,
|
||||
common_local_url('ApiTimelineTag',
|
||||
array('format' => 'as',
|
||||
'tag' => $this->tag)),
|
||||
// TRANS: Link label for feed on "notices with tag" page.
|
||||
// TRANS: %s is the tag the feed is for.
|
||||
sprintf(_('Notice feed for tag %s (Activity Streams JSON)'),
|
||||
$this->tag)),
|
||||
new Feed(Feed::RSS1,
|
||||
common_local_url('tagrss',
|
||||
array('tag' => $this->tag)),
|
||||
// TRANS: Link label for feed on "notices with tag" page.
|
||||
|
|
86
actions/top.php
Normal file
86
actions/top.php
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2011, StatusNet, Inc.
|
||||
*
|
||||
* Redirect to the appropriate top-of-site
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* @category Top
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* An action to redirect to the top of the site
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class TopAction extends Action
|
||||
{
|
||||
/**
|
||||
* For initializing members of the class.
|
||||
*
|
||||
* @param array $argarray misc. arguments
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler method
|
||||
*
|
||||
* @param array $argarray is ignored since it's now passed in in prepare()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($argarray=null)
|
||||
{
|
||||
if (common_config('singleuser', 'enabled')) {
|
||||
$url = common_local_url('showstream', array('nickname' => User::singleUserNickname()));
|
||||
} else {
|
||||
$url = common_local_url('public');
|
||||
}
|
||||
|
||||
// XXX: Permanent? I think so.
|
||||
|
||||
common_redirect($url, 301);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -300,7 +300,7 @@ class UserAdminPanelForm extends AdminForm
|
|||
_m('BUTTON','Save'),
|
||||
'submit',
|
||||
null,
|
||||
// TRANS: Title for button to save user settings in user admin panel.
|
||||
// TRANS: Button title to save user settings in user admin panel.
|
||||
_('Save user settings.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,365 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Change user password
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: 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/>.
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/designsettings.php';
|
||||
|
||||
/**
|
||||
* Set a user's design
|
||||
*
|
||||
* Saves a design for a given user
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class UserDesignSettingsAction extends DesignSettingsAction
|
||||
{
|
||||
/**
|
||||
* Sets the right action for the form, and passes request args into
|
||||
* the base action
|
||||
*
|
||||
* @param array $args misc. arguments
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
$this->submitaction = common_local_url('userdesignsettings');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for profile design page.
|
||||
return _('Profile design');
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions for use
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for Profile design page.
|
||||
return _('Customize the way your profile looks ' .
|
||||
'with a background image and a colour palette of your choice.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the design we want to edit
|
||||
*
|
||||
* @return Design
|
||||
*/
|
||||
function getWorkingDesign()
|
||||
{
|
||||
$user = common_current_user();
|
||||
$design = $user->getDesign();
|
||||
return $design;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content area of the page
|
||||
*
|
||||
* Shows a form for changing the design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showContent()
|
||||
{
|
||||
$design = $this->getWorkingDesign();
|
||||
|
||||
if (empty($design)) {
|
||||
$design = Design::siteDesign();
|
||||
}
|
||||
|
||||
$this->showDesignForm($design);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the design settings form
|
||||
*
|
||||
* @param Design $design a working design to show
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
|
||||
function showDesignForm($design)
|
||||
{
|
||||
$form = new UserDesignForm($this, $design, $this->submitaction);
|
||||
$form->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save or update the user's design settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function saveDesign()
|
||||
{
|
||||
$this->saveDesignPreferences();
|
||||
|
||||
foreach ($this->args as $key => $val) {
|
||||
if (preg_match('/(#ho|ho)Td.*g/i', $val)) {
|
||||
$this->sethd();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
||||
$tcolor = new WebColor($this->trimmed('design_text'));
|
||||
$lcolor = new WebColor($this->trimmed('design_links'));
|
||||
} catch (WebColorException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
$onoff = $this->arg('design_background-image_onoff');
|
||||
|
||||
$on = false;
|
||||
$off = false;
|
||||
$tile = false;
|
||||
|
||||
if ($onoff == 'on') {
|
||||
$on = true;
|
||||
} else {
|
||||
$off = true;
|
||||
}
|
||||
|
||||
$repeat = $this->boolean('design_background-image_repeat');
|
||||
|
||||
if ($repeat) {
|
||||
$tile = true;
|
||||
}
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
$design = $user->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
$original = clone($design);
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when updating design settings has failed.
|
||||
$this->showForm(_('Could not update your design.'));
|
||||
return;
|
||||
}
|
||||
// update design
|
||||
} else {
|
||||
$user->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
$design = new Design();
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when saving design settings has failed.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($user);
|
||||
$user->design_id = $id;
|
||||
$result = $user->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when saving design settings has failed.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
$user->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$user->query('COMMIT');
|
||||
|
||||
}
|
||||
|
||||
$this->saveBackgroundImage($design);
|
||||
|
||||
// TRANS: Confirmation message on Profile design page when saving design settings has succeeded.
|
||||
$this->showForm(_('Design preferences saved.'), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alternate default colors
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function sethd()
|
||||
{
|
||||
$user = common_current_user();
|
||||
$design = $user->getDesign();
|
||||
|
||||
$user->query('BEGIN');
|
||||
|
||||
// alternate colors
|
||||
$design = new Design();
|
||||
|
||||
$design->backgroundcolor = 16184329;
|
||||
$design->contentcolor = 16059904;
|
||||
$design->sidebarcolor = 16059904;
|
||||
$design->textcolor = 0;
|
||||
$design->linkcolor = 16777215;
|
||||
|
||||
$design->setDisposition(false, true, false);
|
||||
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when saving design settings has failed.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($user);
|
||||
$user->design_id = $id;
|
||||
$result = $user->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when updating design settings has failed.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
$user->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$user->query('COMMIT');
|
||||
|
||||
$this->saveBackgroundImage($design);
|
||||
|
||||
// TRANS: Succes message on Profile design page when finding an easter egg.
|
||||
$this->showForm(_('Enjoy your hotdog!'), true);
|
||||
}
|
||||
|
||||
function saveDesignPreferences()
|
||||
{
|
||||
$viewdesigns = $this->boolean('viewdesigns');
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
$original = clone($user);
|
||||
|
||||
$user->viewdesigns = $viewdesigns;
|
||||
|
||||
$result = $user->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server exception thrown on Profile design page when updating design settings fails.
|
||||
throw new ServerException(_('Could not update user.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class UserDesignForm extends DesignForm
|
||||
{
|
||||
function __construct($out, $design, $actionurl)
|
||||
{
|
||||
parent::__construct($out, $design, $actionurl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Legend of the Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formLegend()
|
||||
{
|
||||
// TRANS: Form legend on Profile design page.
|
||||
$this->out->element('legend', null, _('Design settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data elements of the form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formData()
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
$this->out->elementStart('li');
|
||||
// TRANS: Checkbox label on Profile design page.
|
||||
$this->out->checkbox('viewdesigns', _('View profile designs'),
|
||||
// TRANS: Title for checkbox on Profile design page.
|
||||
- $user->viewdesigns, _('Show or hide profile designs.'));
|
||||
$this->out->elementEnd('li');
|
||||
$this->out->elementEnd('ul');
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementStart('fieldset');
|
||||
// TRANS: Form legend on Profile design page for form to choose a background image.
|
||||
$this->out->element('legend', null, _('Background file'));
|
||||
|
||||
parent::formData();
|
||||
}
|
||||
}
|
|
@ -104,7 +104,7 @@ class UsergroupsAction extends ProfileAction
|
|||
return false;
|
||||
}
|
||||
|
||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||
$this->page = $this->trimmed('page', 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,8 +29,6 @@ class UserrssAction extends Rss10Action
|
|||
|
||||
function prepare($args)
|
||||
{
|
||||
common_debug("UserrssAction");
|
||||
|
||||
parent::prepare($args);
|
||||
$nickname = $this->trimmed('nickname');
|
||||
$this->user = User::staticGet('nickname', $nickname);
|
||||
|
|
|
@ -30,6 +30,7 @@ class UserxrdAction extends XrdAction
|
|||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
global $config;
|
||||
|
||||
$this->uri = $this->trimmed('uri');
|
||||
$this->uri = self::normalize($this->uri);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2008, 2009, StatusNet, Inc.
|
||||
* Copyright (C) 2008-2011, StatusNet, Inc.
|
||||
*
|
||||
* Show version information for this software and plugins
|
||||
*
|
||||
|
@ -42,7 +42,7 @@ if (!defined('STATUSNET')) {
|
|||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @copyright 2009-2011 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
@ -149,7 +149,7 @@ class VersionAction extends Action
|
|||
// TRANS: Content part of StatusNet version page.
|
||||
// TRANS: %1$s is the engine name (StatusNet) and %2$s is the StatusNet version.
|
||||
$this->raw(sprintf(_('This site is powered by %1$s version %2$s, '.
|
||||
'Copyright 2008-2010 StatusNet, Inc. '.
|
||||
'Copyright 2008-2011 StatusNet, Inc. '.
|
||||
'and contributors.'),
|
||||
XMLStringer::estring('a', array('href' => 'http://status.net/'),
|
||||
// TRANS: Engine name.
|
||||
|
@ -160,6 +160,7 @@ class VersionAction extends Action
|
|||
// TRANS: Header for StatusNet contributors section on the version page.
|
||||
$this->element('h2', null, _('Contributors'));
|
||||
|
||||
sort($this->contributors);
|
||||
$this->element('p', null, implode(', ', $this->contributors));
|
||||
|
||||
// TRANS: Header for StatusNet license section on the version page.
|
||||
|
@ -170,14 +171,14 @@ class VersionAction extends Action
|
|||
_('StatusNet 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. '));
|
||||
'(at your option) any later version.'));
|
||||
|
||||
$this->element('p', null,
|
||||
// TRANS: Content part of StatusNet version page.
|
||||
_('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. '));
|
||||
'GNU Affero General Public License for more details.'));
|
||||
|
||||
$this->elementStart('p');
|
||||
// TRANS: Content part of StatusNet version page.
|
||||
|
@ -277,6 +278,7 @@ class VersionAction extends Action
|
|||
'mEDI',
|
||||
'Brett Taylor',
|
||||
'Brigitte Schuster',
|
||||
'Brion Vibber',
|
||||
'Siebrand Mazeland');
|
||||
'Brion Vibber (StatusNet)',
|
||||
'Siebrand Mazeland',
|
||||
'Samantha Doherty (StatusNet)');
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
class Avatar extends Memcached_DataObject
|
||||
class Avatar extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
@ -27,6 +27,37 @@ class Avatar extends Memcached_DataObject
|
|||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
static function pivotGet($keyCol, $keyVals, $otherCols)
|
||||
{
|
||||
return Memcached_DataObject::pivotGet('Avatar', $keyCol, $keyVals, $otherCols);
|
||||
}
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(
|
||||
'fields' => array(
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'),
|
||||
'original' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'uploaded by user or generated?'),
|
||||
'width' => array('type' => 'int', 'not null' => true, 'description' => 'image width'),
|
||||
'height' => array('type' => 'int', 'not null' => true, 'description' => 'image height'),
|
||||
'mediatype' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'file type'),
|
||||
'filename' => array('type' => 'varchar', 'length' => 255, 'description' => 'local filename, if local'),
|
||||
'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'avatar location'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'width', 'height'),
|
||||
'unique keys' => array(
|
||||
'avatar_url_key' => array('url'),
|
||||
),
|
||||
'foreign keys' => array(
|
||||
'avatar_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
|
||||
),
|
||||
'indexes' => array(
|
||||
'avatar_profile_id_idx' => array('profile_id'),
|
||||
),
|
||||
);
|
||||
}
|
||||
// We clean up the file, too
|
||||
|
||||
function delete()
|
||||
|
|
|
@ -27,7 +27,7 @@ if (!defined('STATUSNET')) {
|
|||
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
class Config extends Memcached_DataObject
|
||||
class Config extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
@ -43,14 +43,30 @@ class Config extends Memcached_DataObject
|
|||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(
|
||||
'fields' => array(
|
||||
'section' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration section'),
|
||||
'setting' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration setting'),
|
||||
'value' => array('type' => 'varchar', 'length' => 255, 'description' => 'configuration value'),
|
||||
),
|
||||
'primary key' => array('section', 'setting'),
|
||||
);
|
||||
}
|
||||
|
||||
const settingsKey = 'config:settings';
|
||||
|
||||
static function loadSettings()
|
||||
{
|
||||
try {
|
||||
$settings = self::_getSettings();
|
||||
if (!empty($settings)) {
|
||||
self::_applySettings($settings);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static function _getSettings()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
class Confirm_address extends Memcached_DataObject
|
||||
class Confirm_address extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
@ -26,8 +26,25 @@ class Confirm_address extends Memcached_DataObject
|
|||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
function sequenceKey()
|
||||
{ return array(false, false); }
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(
|
||||
'fields' => array(
|
||||
'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'),
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who requested confirmation'),
|
||||
'address' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'address (email, xmpp, SMS, etc.)'),
|
||||
'address_extra' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'carrier ID, for SMS'),
|
||||
'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'),
|
||||
'claimed' => array('type' => 'datetime', 'description' => 'date this was claimed for queueing'),
|
||||
'sent' => array('type' => 'datetime', 'description' => 'date this was sent for queueing'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('code'),
|
||||
'foreign keys' => array(
|
||||
'confirm_address_user_id_fkey' => array('user', array('user_id' => 'id')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static function getAddress($address, $addressType)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
class Consumer extends Memcached_DataObject
|
||||
class Consumer extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
@ -23,6 +23,22 @@ class Consumer extends Memcached_DataObject
|
|||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(
|
||||
'description' => 'OAuth consumer record',
|
||||
'fields' => array(
|
||||
'consumer_key' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'unique identifier, root URL'),
|
||||
'consumer_secret' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'secret value'),
|
||||
'seed' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'seed for new tokens by this consumer'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('consumer_key'),
|
||||
);
|
||||
}
|
||||
|
||||
static function generateNew()
|
||||
{
|
||||
$cons = new Consumer();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
|
||||
class Conversation extends Memcached_DataObject
|
||||
class Conversation extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
@ -46,6 +46,22 @@ class Conversation extends Memcached_DataObject
|
|||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(
|
||||
'fields' => array(
|
||||
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 225, 'description' => 'URI of the conversation'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
'conversation_uri_key' => array('uri'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for creating a new conversation
|
||||
*
|
||||
|
|
|
@ -26,7 +26,7 @@ if (!defined('STATUSNET')) {
|
|||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
class Deleted_notice extends Memcached_DataObject
|
||||
class Deleted_notice extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
@ -43,4 +43,24 @@ class Deleted_notice extends Memcached_DataObject
|
|||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(
|
||||
'fields' => array(
|
||||
'id' => array('type' => 'int', 'not null' => true, 'description' => 'identity of notice'),
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'author of the notice'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the notice record was created'),
|
||||
'deleted' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the notice record was created'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
'deleted_notice_uri_key' => array('uri'),
|
||||
),
|
||||
'indexes' => array(
|
||||
'deleted_notice_profile_id_idx' => array('profile_id'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,243 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 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/>.
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
define('BACKGROUND_ON', 1);
|
||||
define('BACKGROUND_OFF', 2);
|
||||
define('BACKGROUND_TILE', 4);
|
||||
|
||||
/**
|
||||
* Table Definition for design
|
||||
*/
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
require_once INSTALLDIR . '/lib/webcolor.php';
|
||||
|
||||
class Design extends Memcached_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
||||
public $__table = 'design'; // table name
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $backgroundcolor; // int(4)
|
||||
public $contentcolor; // int(4)
|
||||
public $sidebarcolor; // int(4)
|
||||
public $textcolor; // int(4)
|
||||
public $linkcolor; // int(4)
|
||||
public $backgroundimage; // varchar(255)
|
||||
public $disposition; // tinyint(1) default_1
|
||||
|
||||
/* Static get */
|
||||
function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Design',$k,$v); }
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
function showCSS($out)
|
||||
{
|
||||
$css = '';
|
||||
|
||||
$bgcolor = Design::toWebColor($this->backgroundcolor);
|
||||
|
||||
if (!empty($bgcolor)) {
|
||||
$css .= 'body { background-color: #' . $bgcolor->hexValue() . ' }' . "\n";
|
||||
}
|
||||
|
||||
$ccolor = Design::toWebColor($this->contentcolor);
|
||||
|
||||
if (!empty($ccolor)) {
|
||||
$css .= '#content, #site_nav_local_views .current a { background-color: #';
|
||||
$css .= $ccolor->hexValue() . '} '."\n";
|
||||
}
|
||||
|
||||
$sbcolor = Design::toWebColor($this->sidebarcolor);
|
||||
|
||||
if (!empty($sbcolor)) {
|
||||
$css .= '#aside_primary { background-color: #'. $sbcolor->hexValue() . ' }' . "\n";
|
||||
}
|
||||
|
||||
$tcolor = Design::toWebColor($this->textcolor);
|
||||
|
||||
if (!empty($tcolor)) {
|
||||
$css .= 'html body { color: #'. $tcolor->hexValue() . ' }'. "\n";
|
||||
}
|
||||
|
||||
$lcolor = Design::toWebColor($this->linkcolor);
|
||||
|
||||
if (!empty($lcolor)) {
|
||||
$css .= 'a { color: #' . $lcolor->hexValue() . ' }' . "\n";
|
||||
}
|
||||
|
||||
if (!empty($this->backgroundimage) &&
|
||||
$this->disposition & BACKGROUND_ON) {
|
||||
|
||||
$repeat = ($this->disposition & BACKGROUND_TILE) ?
|
||||
'background-repeat:repeat;' :
|
||||
'background-repeat:no-repeat;';
|
||||
|
||||
$css .= 'body { background-image:url(' .
|
||||
Design::url($this->backgroundimage) .
|
||||
'); ' . $repeat . ' background-attachment:fixed; }' . "\n";
|
||||
}
|
||||
|
||||
if (0 != mb_strlen($css)) {
|
||||
$out->style($css);
|
||||
}
|
||||
}
|
||||
|
||||
static function toWebColor($color)
|
||||
{
|
||||
if ($color === null || $color === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return new WebColor($color);
|
||||
} catch (WebColorException $e) {
|
||||
// This shouldn't happen
|
||||
common_log(LOG_ERR, "Unable to create web color for $color",
|
||||
__FILE__);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static function filename($id, $extension, $extra=null)
|
||||
{
|
||||
return $id . (($extra) ? ('-' . $extra) : '') . $extension;
|
||||
}
|
||||
|
||||
static function path($filename)
|
||||
{
|
||||
$dir = common_config('background', 'dir');
|
||||
|
||||
if ($dir[strlen($dir)-1] != '/') {
|
||||
$dir .= '/';
|
||||
}
|
||||
|
||||
return $dir . $filename;
|
||||
}
|
||||
|
||||
static function url($filename)
|
||||
{
|
||||
if (StatusNet::isHTTPS()) {
|
||||
|
||||
$sslserver = common_config('background', 'sslserver');
|
||||
|
||||
if (empty($sslserver)) {
|
||||
// XXX: this assumes that background dir == site dir + /background/
|
||||
// not true if there's another server
|
||||
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') . '/background/';
|
||||
} else {
|
||||
$server = $sslserver;
|
||||
$path = common_config('background', 'sslpath');
|
||||
if (empty($path)) {
|
||||
$path = common_config('background', 'path');
|
||||
}
|
||||
}
|
||||
|
||||
$protocol = 'https';
|
||||
|
||||
} else {
|
||||
|
||||
$path = common_config('background', 'path');
|
||||
|
||||
$server = common_config('background', 'server');
|
||||
|
||||
if (empty($server)) {
|
||||
$server = common_config('site', 'server');
|
||||
}
|
||||
|
||||
$protocol = 'http';
|
||||
}
|
||||
|
||||
if ($path[strlen($path)-1] != '/') {
|
||||
$path .= '/';
|
||||
}
|
||||
|
||||
if ($path[0] != '/') {
|
||||
$path = '/'.$path;
|
||||
}
|
||||
|
||||
return $protocol.'://'.$server.$path.$filename;
|
||||
}
|
||||
|
||||
function setDisposition($on, $off, $tile)
|
||||
{
|
||||
if ($on) {
|
||||
$this->disposition |= BACKGROUND_ON;
|
||||
} else {
|
||||
$this->disposition &= ~BACKGROUND_ON;
|
||||
}
|
||||
|
||||
if ($off) {
|
||||
$this->disposition |= BACKGROUND_OFF;
|
||||
} else {
|
||||
$this->disposition &= ~BACKGROUND_OFF;
|
||||
}
|
||||
|
||||
if ($tile) {
|
||||
$this->disposition |= BACKGROUND_TILE;
|
||||
} else {
|
||||
$this->disposition &= ~BACKGROUND_TILE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a design object based on the configured site design.
|
||||
*
|
||||
* @return Design a singleton design object for the site.
|
||||
*/
|
||||
|
||||
static function siteDesign()
|
||||
{
|
||||
static $siteDesign = null;
|
||||
|
||||
if (empty($siteDesign)) {
|
||||
|
||||
$siteDesign = new Design();
|
||||
|
||||
$attrs = array('backgroundcolor',
|
||||
'contentcolor',
|
||||
'sidebarcolor',
|
||||
'textcolor',
|
||||
'linkcolor',
|
||||
'backgroundimage',
|
||||
'disposition');
|
||||
|
||||
foreach ($attrs as $attr) {
|
||||
$val = common_config('design', $attr);
|
||||
if ($val !== false) {
|
||||
$siteDesign->$attr = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $siteDesign;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||
|
||||
class Fave extends Memcached_DataObject
|
||||
class Fave extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
@ -12,6 +12,7 @@ class Fave extends Memcached_DataObject
|
|||
public $__table = 'fave'; // table name
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $user_id; // int(4) primary_key not_null
|
||||
public $uri; // varchar(255)
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* Static get */
|
||||
|
@ -21,6 +22,31 @@ class Fave extends Memcached_DataObject
|
|||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(
|
||||
'fields' => array(
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice that is the favorite'),
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who likes this notice'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id', 'user_id'),
|
||||
'unique keys' => array(
|
||||
'fave_uri_key' => array('uri'),
|
||||
),
|
||||
'foreign keys' => array(
|
||||
'fave_notice_id_fkey' => array('notice', array('notice_id' => 'id')),
|
||||
'fave_user_id_fkey' => array('profile', array('user_id' => 'id')), // note: formerly referenced notice.id, but we can now record remote users' favorites
|
||||
),
|
||||
'indexes' => array(
|
||||
'fave_notice_id_idx' => array('notice_id'),
|
||||
'fave_user_id_idx' => array('user_id', 'modified'),
|
||||
'fave_modified_idx' => array('modified'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a favorite record.
|
||||
* @fixme post-author notification should be moved here
|
||||
|
@ -39,12 +65,16 @@ class Fave extends Memcached_DataObject
|
|||
|
||||
$fave->user_id = $profile->id;
|
||||
$fave->notice_id = $notice->id;
|
||||
|
||||
$fave->modified = common_sql_now();
|
||||
$fave->uri = self::newURI($fave->user_id,
|
||||
$fave->notice_id,
|
||||
$fave->modified);
|
||||
if (!$fave->insert()) {
|
||||
common_log_db_error($fave, 'INSERT', __FILE__);
|
||||
return false;
|
||||
}
|
||||
self::blow('fave:by_notice:%d', $fave->notice_id);
|
||||
self::blow('fave:list-ids:notice_id:%d', $fave->notice_id);
|
||||
self::blow('popular');
|
||||
|
||||
Event::handle('EndFavorNotice', array($profile, $notice));
|
||||
}
|
||||
|
@ -62,7 +92,8 @@ class Fave extends Memcached_DataObject
|
|||
if (Event::handle('StartDisfavorNotice', array($profile, $notice, &$result))) {
|
||||
|
||||
$result = parent::delete();
|
||||
self::blow('fave:by_notice:%d', $this->notice_id);
|
||||
self::blow('fave:list-ids:notice_id:%d', $this->notice_id);
|
||||
self::blow('popular');
|
||||
|
||||
if ($result) {
|
||||
Event::handle('EndDisfavorNotice', array($profile, $notice));
|
||||
|
@ -94,18 +125,24 @@ class Fave extends Memcached_DataObject
|
|||
function asActivity()
|
||||
{
|
||||
$notice = Notice::staticGet('id', $this->notice_id);
|
||||
|
||||
if (!$notice) {
|
||||
throw new Exception("Fave for non-existent notice: " . $this->notice_id);
|
||||
}
|
||||
|
||||
$profile = Profile::staticGet('id', $this->user_id);
|
||||
|
||||
if (!$profile) {
|
||||
throw new Exception("Fave by non-existent profile: " . $this->user_id);
|
||||
}
|
||||
|
||||
$act = new Activity();
|
||||
|
||||
$act->verb = ActivityVerb::FAVORITE;
|
||||
|
||||
// FIXME: rationalize this with URL below
|
||||
|
||||
$act->id = TagURI::mint('favor:%d:%d:%s',
|
||||
$profile->id,
|
||||
$notice->id,
|
||||
common_date_iso8601($this->modified));
|
||||
$act->id = $this->getURI();
|
||||
|
||||
$act->time = strtotime($this->modified);
|
||||
// TRANS: Activity title when marking a notice as favorite.
|
||||
|
@ -157,30 +194,20 @@ class Fave extends Memcached_DataObject
|
|||
return $fav;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab a list of profile who have favored this notice.
|
||||
*
|
||||
* @return ArrayWrapper masquerading as a Fave
|
||||
*/
|
||||
static function byNotice($noticeId)
|
||||
function getURI()
|
||||
{
|
||||
$c = self::memcache();
|
||||
$key = Cache::key('fave:by_notice:' . $noticeId);
|
||||
|
||||
$wrapper = $c->get($key);
|
||||
if (!$wrapper) {
|
||||
// @fixme caching & scalability!
|
||||
$fave = new Fave();
|
||||
$fave->notice_id = $noticeId;
|
||||
$fave->find();
|
||||
|
||||
$list = array();
|
||||
while ($fave->fetch()) {
|
||||
$list[] = clone($fave);
|
||||
if (!empty($this->uri)) {
|
||||
return $this->uri;
|
||||
} else {
|
||||
return self::newURI($this->user_id, $this->notice_id, $this->modified);
|
||||
}
|
||||
$wrapper = new ArrayWrapper($list);
|
||||
$c->set($key, $wrapper);
|
||||
}
|
||||
return $wrapper;
|
||||
|
||||
static function newURI($profile_id, $notice_id, $modified)
|
||||
{
|
||||
return TagURI::mint('favor:%d:%d:%s',
|
||||
$profile_id,
|
||||
$notice_id,
|
||||
common_date_iso8601($modified));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ require_once INSTALLDIR.'/classes/File_to_post.php';
|
|||
/**
|
||||
* Table Definition for file
|
||||
*/
|
||||
class File extends Memcached_DataObject
|
||||
class File extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
@ -51,25 +51,30 @@ class File extends Memcached_DataObject
|
|||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
function isProtected($url) {
|
||||
return 'http://www.facebook.com/login.php' === $url;
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(
|
||||
'fields' => array(
|
||||
'id' => array('type' => 'serial', 'not null' => true),
|
||||
'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'destination URL after following redirections'),
|
||||
'mimetype' => array('type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'),
|
||||
'size' => array('type' => 'int', 'description' => 'size of resource when available'),
|
||||
'title' => array('type' => 'varchar', 'length' => 255, 'description' => 'title of resource when available'),
|
||||
'date' => array('type' => 'int', 'description' => 'date of resource according to http query'),
|
||||
'protected' => array('type' => 'int', 'description' => 'true when URL is private (needs login)'),
|
||||
'filename' => array('type' => 'varchar', 'length' => 255, 'description' => 'if a local file, name of the file'),
|
||||
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
'file_url_key' => array('url'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for a particlar notice.
|
||||
*
|
||||
* @param int $post_id
|
||||
* @return array of File objects
|
||||
*/
|
||||
static function getAttachments($post_id) {
|
||||
$file = new File();
|
||||
$query = "select file.* from file join file_to_post on (file_id = file.id) where post_id = " . $file->escape($post_id);
|
||||
$file = Memcached_DataObject::cachedQuery('File', $query);
|
||||
$att = array();
|
||||
while ($file->fetch()) {
|
||||
$att[] = clone($file);
|
||||
}
|
||||
return $att;
|
||||
function isProtected($url) {
|
||||
return 'http://www.facebook.com/login.php' === $url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,6 +85,13 @@ class File extends Memcached_DataObject
|
|||
* @return File
|
||||
*/
|
||||
function saveNew(array $redir_data, $given_url) {
|
||||
|
||||
// I don't know why we have to keep doing this but I'm adding this last check to avoid
|
||||
// uniqueness bugs.
|
||||
|
||||
$x = File::staticGet('url', $given_url);
|
||||
|
||||
if (empty($x)) {
|
||||
$x = new File;
|
||||
$x->url = $given_url;
|
||||
if (!empty($redir_data['protected'])) $x->protected = $redir_data['protected'];
|
||||
|
@ -88,6 +100,7 @@ class File extends Memcached_DataObject
|
|||
if (!empty($redir_data['size'])) $x->size = intval($redir_data['size']);
|
||||
if (isset($redir_data['time']) && $redir_data['time'] > 0) $x->date = intval($redir_data['time']);
|
||||
$file_id = $x->insert();
|
||||
}
|
||||
|
||||
$x->saveOembed($redir_data, $given_url);
|
||||
return $x;
|
||||
|
@ -187,7 +200,7 @@ class File extends Memcached_DataObject
|
|||
}
|
||||
|
||||
if (empty($x)) {
|
||||
$x = File::staticGet($file_id);
|
||||
$x = File::staticGet('id', $file_id);
|
||||
if (empty($x)) {
|
||||
// @todo FIXME: This could possibly be a clearer message :)
|
||||
// TRANS: Server exception thrown when... Robin thinks something is impossible!
|
||||
|
@ -204,13 +217,20 @@ class File extends Memcached_DataObject
|
|||
function isRespectsQuota($user,$fileSize) {
|
||||
|
||||
if ($fileSize > common_config('attachments', 'file_quota')) {
|
||||
// TRANS: Message used to be inserted as %2$s in the text "No file may
|
||||
// TRANS: be larger than %1$d byte and the file you sent was %2$s.".
|
||||
// TRANS: %1$d is the number of bytes of an uploaded file.
|
||||
$fileSizeText = sprintf(_m('%1$d byte','%1$d bytes',$fileSize),$fileSize);
|
||||
|
||||
$fileQuota = common_config('attachments', 'file_quota');
|
||||
// TRANS: Message given if an upload is larger than the configured maximum.
|
||||
// TRANS: %1$d is the byte limit for uploads, %2$d is the byte count for the uploaded file.
|
||||
// TRANS: %1$s is used for plural.
|
||||
return sprintf(_m('No file may be larger than %1$d byte and the file you sent was %2$d bytes. Try to upload a smaller version.',
|
||||
'No file may be larger than %1$d bytes and the file you sent was %2$d bytes. Try to upload a smaller version.',
|
||||
common_config('attachments', 'file_quota')),
|
||||
common_config('attachments', 'file_quota'), $fileSize);
|
||||
// TRANS: %1$d (used for plural) is the byte limit for uploads,
|
||||
// TRANS: %2$s is the proper form of "n bytes". This is the only ways to have
|
||||
// TRANS: gettext support multiple plurals in the same message, unfortunately...
|
||||
return sprintf(_m('No file may be larger than %1$d byte and the file you sent was %2$s. Try to upload a smaller version.',
|
||||
'No file may be larger than %1$d bytes and the file you sent was %2$s. Try to upload a smaller version.',
|
||||
$fileQuota),
|
||||
$fileQuota, $fileSizeText);
|
||||
}
|
||||
|
||||
$query = "select sum(size) as total from file join file_to_post on file_to_post.file_id = file.id join notice on file_to_post.post_id = notice.id where profile_id = {$user->id} and file.url like '%/notice/%/file'";
|
||||
|
|
|
@ -26,7 +26,7 @@ require_once INSTALLDIR.'/classes/File_redirection.php';
|
|||
* Table Definition for file_oembed
|
||||
*/
|
||||
|
||||
class File_oembed extends Memcached_DataObject
|
||||
class File_oembed extends Managed_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
@ -53,9 +53,30 @@ class File_oembed extends Memcached_DataObject
|
|||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
function sequenceKey()
|
||||
public static function schemaDef()
|
||||
{
|
||||
return array(false, false, false);
|
||||
return array(
|
||||
'fields' => array(
|
||||
'file_id' => array('type' => 'int', 'not null' => true, 'description' => 'oEmbed for that URL/file'),
|
||||
'version' => array('type' => 'varchar', 'length' => 20, 'description' => 'oEmbed spec. version'),
|
||||
'type' => array('type' => 'varchar', 'length' => 20, 'description' => 'oEmbed type: photo, video, link, rich'),
|
||||
'mimetype' => array('type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'),
|
||||
'provider' => array('type' => 'varchar', 'length' => 50, 'description' => 'name of this oEmbed provider'),
|
||||
'provider_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of this oEmbed provider'),
|
||||
'width' => array('type' => 'int', 'description' => 'width of oEmbed resource when available'),
|
||||
'height' => array('type' => 'int', 'description' => 'height of oEmbed resource when available'),
|
||||
'html' => array('type' => 'text', 'description' => 'html representation of this oEmbed resource when applicable'),
|
||||
'title' => array('type' => 'varchar', 'length' => 255, 'description' => 'title of oEmbed resource when available'),
|
||||
'author_name' => array('type' => 'varchar', 'length' => 50, 'description' => 'author name for this oEmbed resource'),
|
||||
'author_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'author URL for this oEmbed resource'),
|
||||
'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL for this oEmbed resource when applicable (photo, link)'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('file_id'),
|
||||
'foreign keys' => array(
|
||||
'file_oembed_file_id_fkey' => array('file', array('file_id' => 'id')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function _getOembed($url) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user