Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
This commit is contained in:
commit
84e7c7783c
37
README
37
README
@ -2,8 +2,8 @@
|
|||||||
README
|
README
|
||||||
------
|
------
|
||||||
|
|
||||||
StatusNet 0.9.0 ("Stand") Beta 3
|
StatusNet 0.9.0 ("Stand") Beta 4
|
||||||
20 Jan 2010
|
27 Jan 2010
|
||||||
|
|
||||||
This is the README file for StatusNet (formerly Laconica), the Open
|
This is the README file for StatusNet (formerly Laconica), the Open
|
||||||
Source microblogging platform. It includes installation instructions,
|
Source microblogging platform. It includes installation instructions,
|
||||||
@ -597,26 +597,19 @@ server is probably a good idea for high-volume sites.
|
|||||||
needs as a parameter the install path; if you run it from the
|
needs as a parameter the install path; if you run it from the
|
||||||
StatusNet dir, "." should suffice.
|
StatusNet dir, "." should suffice.
|
||||||
|
|
||||||
This will run eight (for now) queue handlers:
|
This will run the queue handlers:
|
||||||
|
|
||||||
|
* queuedaemon.php - polls for queued items for inbox processing and
|
||||||
|
pushing out to OMB, SMS, XMPP, etc.
|
||||||
* xmppdaemon.php - listens for new XMPP messages from users and stores
|
* xmppdaemon.php - listens for new XMPP messages from users and stores
|
||||||
them as notices in the database.
|
them as notices in the database; also pulls queued XMPP output from
|
||||||
* jabberqueuehandler.php - sends queued notices in the database to
|
queuedaemon.php to push out to clients.
|
||||||
registered users who should receive them.
|
|
||||||
* publicqueuehandler.php - sends queued notices in the database to
|
|
||||||
public feed listeners.
|
|
||||||
* ombqueuehandler.php - sends queued notices to OpenMicroBlogging
|
|
||||||
recipients on foreign servers.
|
|
||||||
* smsqueuehandler.php - sends queued notices to SMS-over-email addresses
|
|
||||||
of registered users.
|
|
||||||
* xmppconfirmhandler.php - sends confirmation messages to registered
|
|
||||||
users.
|
|
||||||
|
|
||||||
Note that these queue daemons are pretty raw, and need your care. In
|
These two daemons will automatically restart in most cases of failure
|
||||||
particular, they leak memory, and you may want to restart them on a
|
including memory leaks (if a memory_limit is set), but may still die
|
||||||
regular (daily or so) basis with a cron job. Also, if they lose
|
or behave oddly if they lose connections to the XMPP or queue servers.
|
||||||
the connection to the XMPP server for too long, they'll simply die. It
|
|
||||||
may be a good idea to use a daemon-monitoring service, like 'monit',
|
It may be a good idea to use a daemon-monitoring service, like 'monit',
|
||||||
to check their status and keep them running.
|
to check their status and keep them running.
|
||||||
|
|
||||||
All the daemons write their process IDs (pids) to /var/run/ by
|
All the daemons write their process IDs (pids) to /var/run/ by
|
||||||
@ -626,7 +619,7 @@ daemons.
|
|||||||
Since version 0.8.0, it's now possible to use a STOMP server instead of
|
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. See the "queues"
|
our kind of hacky home-grown DB-based queue solution. See the "queues"
|
||||||
config section below for how to configure to use STOMP. As of this
|
config section below for how to configure to use STOMP. As of this
|
||||||
writing, the software has been tested with ActiveMQ (
|
writing, the software has been tested with ActiveMQ.
|
||||||
|
|
||||||
Sitemaps
|
Sitemaps
|
||||||
--------
|
--------
|
||||||
@ -712,10 +705,12 @@ subdirectory to add a new language to your system. You'll need to
|
|||||||
compile the ".po" files into ".mo" files, however.
|
compile the ".po" files into ".mo" files, however.
|
||||||
|
|
||||||
Contributions of translation information to StatusNet are very easy:
|
Contributions of translation information to StatusNet are very easy:
|
||||||
you can use the Web interface at http://status.net/pootle/ to add one
|
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
|
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.
|
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
|
Backups
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -105,7 +105,22 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
|
|||||||
print json_encode($out);
|
print json_encode($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->endDocument($this->format);
|
$this->endDocument($this->format);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if read only.
|
||||||
|
*
|
||||||
|
* MAY override
|
||||||
|
*
|
||||||
|
* @param array $args other arguments
|
||||||
|
*
|
||||||
|
* @return boolean is read only action?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isReadOnly($args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -116,4 +116,19 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if read only.
|
||||||
|
*
|
||||||
|
* MAY override
|
||||||
|
*
|
||||||
|
* @param array $args other arguments
|
||||||
|
*
|
||||||
|
* @return boolean is read only action?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isReadOnly($args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether this API resource requires auth. Overloaded to look
|
* Determines whether this API resource requires auth. Overloaded to look
|
||||||
* return true in case source_id and source_screen_name are both empty
|
* return true in case source_id and source_screen_name are both empty
|
||||||
@ -165,4 +164,19 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if read only.
|
||||||
|
*
|
||||||
|
* MAY override
|
||||||
|
*
|
||||||
|
* @param array $args other arguments
|
||||||
|
*
|
||||||
|
* @return boolean is read only action?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isReadOnly($args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -119,4 +119,19 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if read only.
|
||||||
|
*
|
||||||
|
* MAY override
|
||||||
|
*
|
||||||
|
* @param array $args other arguments
|
||||||
|
*
|
||||||
|
* @return boolean is read only action?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isReadOnly($args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -149,4 +149,19 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if read only.
|
||||||
|
*
|
||||||
|
* MAY override
|
||||||
|
*
|
||||||
|
* @param array $args other arguments
|
||||||
|
*
|
||||||
|
* @return boolean is read only action?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isReadOnly($args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -92,5 +92,20 @@ class ApiHelpTestAction extends ApiPrivateAuthAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if read only.
|
||||||
|
*
|
||||||
|
* MAY override
|
||||||
|
*
|
||||||
|
* @param array $args other arguments
|
||||||
|
*
|
||||||
|
* @return boolean is read only action?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isReadOnly($args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,8 +303,9 @@ class ApiOauthAuthorizeAction extends ApiOauthAction
|
|||||||
$access = ($this->app->access_type & Oauth_application::$writeAccess) ?
|
$access = ($this->app->access_type & Oauth_application::$writeAccess) ?
|
||||||
'access and update' : 'access';
|
'access and update' : 'access';
|
||||||
|
|
||||||
$msg = _("The application <strong>%s</strong> by <strong>%s</strong> would like " .
|
$msg = _('The application <strong>%1$s</strong> by ' .
|
||||||
"the ability to <strong>%s</strong> your account data.");
|
'<strong>%2$s</strong> would like the ability ' .
|
||||||
|
'to <strong>%3$s</strong> your account data.');
|
||||||
|
|
||||||
$this->raw(sprintf($msg,
|
$this->raw(sprintf($msg,
|
||||||
$this->app->name,
|
$this->app->name,
|
||||||
|
@ -138,5 +138,20 @@ class ApiStatusnetConfigAction extends ApiAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if read only.
|
||||||
|
*
|
||||||
|
* MAY override
|
||||||
|
*
|
||||||
|
* @param array $args other arguments
|
||||||
|
*
|
||||||
|
* @return boolean is read only action?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isReadOnly($args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,5 +98,20 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if read only.
|
||||||
|
*
|
||||||
|
* MAY override
|
||||||
|
*
|
||||||
|
* @param array $args other arguments
|
||||||
|
*
|
||||||
|
* @return boolean is read only action?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isReadOnly($args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,4 +123,19 @@ class ApiUserShowAction extends ApiPrivateAuthAction
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if read only.
|
||||||
|
*
|
||||||
|
* MAY override
|
||||||
|
*
|
||||||
|
* @param array $args other arguments
|
||||||
|
*
|
||||||
|
* @return boolean is read only action?
|
||||||
|
*/
|
||||||
|
|
||||||
|
function isReadOnly($args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -326,9 +326,13 @@ class Notice extends Memcached_DataObject
|
|||||||
# XXX: someone clever could prepend instead of clearing the cache
|
# XXX: someone clever could prepend instead of clearing the cache
|
||||||
$notice->blowOnInsert();
|
$notice->blowOnInsert();
|
||||||
|
|
||||||
$qm = QueueManager::get();
|
if (common_config('queue', 'inboxes')) {
|
||||||
|
$qm = QueueManager::get();
|
||||||
$qm->enqueue($notice, 'distrib');
|
$qm->enqueue($notice, 'distrib');
|
||||||
|
} else {
|
||||||
|
$handler = new DistribQueueHandler();
|
||||||
|
$handler->handle($notice);
|
||||||
|
}
|
||||||
|
|
||||||
return $notice;
|
return $notice;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
create table queue_item_new (
|
|
||||||
id integer auto_increment primary key comment 'unique identifier',
|
|
||||||
frame blob not null comment 'data: object reference or opaque string',
|
|
||||||
transport varchar(8) not null comment 'queue for what? "email", "jabber", "sms", "irc", ...',
|
|
||||||
created datetime not null comment 'date this record was created',
|
|
||||||
claimed datetime comment 'date this item was claimed',
|
|
||||||
|
|
||||||
index queue_item_created_idx (created)
|
|
||||||
|
|
||||||
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
|
|
||||||
|
|
||||||
insert into queue_item_new (frame,transport,created,claimed)
|
|
||||||
select notice_id,transport,created,claimed from queue_item;
|
|
||||||
alter table queue_item rename to queue_item_old;
|
|
||||||
alter table queue_item_new rename to queue_item;
|
|
||||||
|
|
50
db/rc3torc4.sql
Normal file
50
db/rc3torc4.sql
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
create table queue_item_new (
|
||||||
|
id integer auto_increment primary key comment 'unique identifier',
|
||||||
|
frame blob not null comment 'data: object reference or opaque string',
|
||||||
|
transport varchar(8) not null comment 'queue for what? "email", "jabber", "sms", "irc", ...',
|
||||||
|
created datetime not null comment 'date this record was created',
|
||||||
|
claimed datetime comment 'date this item was claimed',
|
||||||
|
|
||||||
|
index queue_item_created_idx (created)
|
||||||
|
|
||||||
|
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
|
|
||||||
|
insert into queue_item_new (frame,transport,created,claimed)
|
||||||
|
select notice_id,transport,created,claimed from queue_item;
|
||||||
|
alter table queue_item rename to queue_item_old;
|
||||||
|
alter table queue_item_new rename to queue_item;
|
||||||
|
|
||||||
|
alter table consumer
|
||||||
|
add consumer_secret varchar(255) not null comment 'secret value';
|
||||||
|
|
||||||
|
alter table token
|
||||||
|
add verifier varchar(255) comment 'verifier string for OAuth 1.0a',
|
||||||
|
add verified_callback varchar(255) comment 'verified callback URL for OAuth 1.0a';
|
||||||
|
|
||||||
|
create table oauth_application (
|
||||||
|
id integer auto_increment primary key comment 'unique identifier',
|
||||||
|
owner integer not null comment 'owner of the application' references profile (id),
|
||||||
|
consumer_key varchar(255) not null comment 'application consumer key' references consumer (consumer_key),
|
||||||
|
name varchar(255) not null comment 'name of the application',
|
||||||
|
description varchar(255) comment 'description of the application',
|
||||||
|
icon varchar(255) not null comment 'application icon',
|
||||||
|
source_url varchar(255) comment 'application homepage - used for source link',
|
||||||
|
organization varchar(255) comment 'name of the organization running the application',
|
||||||
|
homepage varchar(255) comment 'homepage for the organization',
|
||||||
|
callback_url varchar(255) comment 'url to redirect to after authentication',
|
||||||
|
type tinyint default 0 comment 'type of app, 1 = browser, 2 = desktop',
|
||||||
|
access_type tinyint default 0 comment 'default access type, bit 1 = read, bit 2 = write',
|
||||||
|
created datetime not null comment 'date this record was created',
|
||||||
|
modified timestamp comment 'date this record was modified'
|
||||||
|
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
|
|
||||||
|
create table oauth_application_user (
|
||||||
|
profile_id integer not null comment 'user of the application' references profile (id),
|
||||||
|
application_id integer not null comment 'id of the application' references oauth_application (id),
|
||||||
|
access_type tinyint default 0 comment 'access type, bit 1 = read, bit 2 = write, bit 3 = revoked',
|
||||||
|
token varchar(255) comment 'request or access token',
|
||||||
|
created datetime not null comment 'date this record was created',
|
||||||
|
modified timestamp comment 'date this record was modified',
|
||||||
|
constraint primary key (profile_id, application_id)
|
||||||
|
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
|
|
@ -57,7 +57,6 @@ class ApiAuthAction extends ApiAction
|
|||||||
var $auth_user_password = null;
|
var $auth_user_password = null;
|
||||||
var $access_token = null;
|
var $access_token = null;
|
||||||
var $oauth_source = null;
|
var $oauth_source = null;
|
||||||
var $auth_user = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take arguments for running, and output basic auth header if needed
|
* Take arguments for running, and output basic auth header if needed
|
||||||
@ -82,18 +81,26 @@ class ApiAuthAction extends ApiAction
|
|||||||
if (!empty($this->access_token)) {
|
if (!empty($this->access_token)) {
|
||||||
$this->checkOAuthRequest();
|
$this->checkOAuthRequest();
|
||||||
} else {
|
} else {
|
||||||
$this->checkBasicAuthUser();
|
$this->checkBasicAuthUser(true);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
// Reject API calls with the wrong access level
|
// Check to see if a basic auth user is there even
|
||||||
|
// if one's not required
|
||||||
|
|
||||||
if ($this->isReadOnly($args) == false) {
|
if (empty($this->access_token)) {
|
||||||
if ($this->access != self::READ_WRITE) {
|
$this->checkBasicAuthUser(false);
|
||||||
$msg = 'API resource requires read-write access, ' .
|
}
|
||||||
'but you only have read access.';
|
}
|
||||||
$this->clientError($msg, 401, $this->format);
|
|
||||||
exit();
|
// Reject API calls with the wrong access level
|
||||||
}
|
|
||||||
|
if ($this->isReadOnly($args) == false) {
|
||||||
|
if ($this->access != self::READ_WRITE) {
|
||||||
|
$msg = _('API resource requires read-write access, ' .
|
||||||
|
'but you only have read access.');
|
||||||
|
$this->clientError($msg, 401, $this->format);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +177,7 @@ class ApiAuthAction extends ApiAction
|
|||||||
($this->access = self::READ_WRITE) ?
|
($this->access = self::READ_WRITE) ?
|
||||||
'read-write' : 'read-only'
|
'read-write' : 'read-only'
|
||||||
));
|
));
|
||||||
return true;
|
return;
|
||||||
} else {
|
} else {
|
||||||
throw new OAuthException('Bad access token.');
|
throw new OAuthException('Bad access token.');
|
||||||
}
|
}
|
||||||
@ -206,13 +213,13 @@ class ApiAuthAction extends ApiAction
|
|||||||
* @return boolean true or false
|
* @return boolean true or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function checkBasicAuthUser()
|
function checkBasicAuthUser($required = true)
|
||||||
{
|
{
|
||||||
$this->basicAuthProcessHeader();
|
$this->basicAuthProcessHeader();
|
||||||
|
|
||||||
$realm = common_config('site', 'name') . ' API';
|
$realm = common_config('site', 'name') . ' API';
|
||||||
|
|
||||||
if (!isset($this->auth_user_nickname)) {
|
if (!isset($this->auth_user_nickname) && $required) {
|
||||||
header('WWW-Authenticate: Basic realm="' . $realm . '"');
|
header('WWW-Authenticate: Basic realm="' . $realm . '"');
|
||||||
|
|
||||||
// show error if the user clicks 'cancel'
|
// show error if the user clicks 'cancel'
|
||||||
@ -226,7 +233,11 @@ class ApiAuthAction extends ApiAction
|
|||||||
$this->auth_user_password);
|
$this->auth_user_password);
|
||||||
|
|
||||||
if (Event::handle('StartSetApiUser', array(&$user))) {
|
if (Event::handle('StartSetApiUser', array(&$user))) {
|
||||||
$this->auth_user = $user;
|
|
||||||
|
if (!empty($user)) {
|
||||||
|
$this->auth_user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
Event::handle('EndSetApiUser', array($user));
|
Event::handle('EndSetApiUser', array($user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,18 +245,18 @@ class ApiAuthAction extends ApiAction
|
|||||||
|
|
||||||
$this->access = self::READ_WRITE;
|
$this->access = self::READ_WRITE;
|
||||||
|
|
||||||
if (empty($this->auth_user)) {
|
if (empty($this->auth_user) && $required) {
|
||||||
|
|
||||||
// basic authentication failed
|
// basic authentication failed
|
||||||
|
|
||||||
list($proxy, $ip) = common_client_ip();
|
list($proxy, $ip) = common_client_ip();
|
||||||
|
|
||||||
common_log(
|
$msg = sprintf(_('Failed API auth attempt, nickname = %1$s, ' .
|
||||||
LOG_WARNING,
|
'proxy = %2$s, ip = %3$s'),
|
||||||
'Failed API auth attempt, nickname = ' .
|
$this->auth_user_nickname,
|
||||||
"$nickname, proxy = $proxy, ip = $ip."
|
$proxy,
|
||||||
);
|
$ip);
|
||||||
|
common_log(LOG_WARNING, $msg);
|
||||||
$this->showAuthError();
|
$this->showAuthError();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
|||||||
//exit with 200 response, if this is checking fancy from the installer
|
//exit with 200 response, if this is checking fancy from the installer
|
||||||
if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; }
|
if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; }
|
||||||
|
|
||||||
define('STATUSNET_VERSION', '0.9.0beta3');
|
define('STATUSNET_VERSION', '0.9.0beta4');
|
||||||
define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
|
define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
|
||||||
|
|
||||||
define('STATUSNET_CODENAME', 'Stand');
|
define('STATUSNET_CODENAME', 'Stand');
|
||||||
|
@ -87,6 +87,7 @@ $default =
|
|||||||
'monitor' => null, // URL to monitor ping endpoint (work in progress)
|
'monitor' => null, // URL to monitor ping endpoint (work in progress)
|
||||||
'softlimit' => '90%', // total size or % of memory_limit at which to restart queue threads gracefully
|
'softlimit' => '90%', // total size or % of memory_limit at which to restart queue threads gracefully
|
||||||
'debug_memory' => false, // true to spit memory usage to log
|
'debug_memory' => false, // true to spit memory usage to log
|
||||||
|
'inboxes' => true, // true to do inbox distribution & output queueing from in background via 'distrib' queue
|
||||||
),
|
),
|
||||||
'license' =>
|
'license' =>
|
||||||
array('type' => 'cc', # can be 'cc', 'allrightsreserved', 'private'
|
array('type' => 'cc', # can be 'cc', 'allrightsreserved', 'private'
|
||||||
|
@ -178,7 +178,8 @@ class StompQueueManager extends QueueManager
|
|||||||
|
|
||||||
$result = $this->con->send($this->queueName($queue),
|
$result = $this->con->send($this->queueName($queue),
|
||||||
$msg, // BODY of the message
|
$msg, // BODY of the message
|
||||||
array ('created' => common_sql_now()));
|
array ('created' => common_sql_now(),
|
||||||
|
'persistent' => 'true'));
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
common_log(LOG_ERR, "Error sending $rep to $queue queue");
|
common_log(LOG_ERR, "Error sending $rep to $queue queue");
|
||||||
|
204
lib/uapplugin.php
Normal file
204
lib/uapplugin.php
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
|
*
|
||||||
|
* UAP (Universal Ad Package) plugin
|
||||||
|
*
|
||||||
|
* 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 Action
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @copyright 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') && !defined('LACONICA')) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract superclass for advertising plugins
|
||||||
|
*
|
||||||
|
* Plugins for showing ads should derive from this plugin.
|
||||||
|
*
|
||||||
|
* Outputs the following ad types (based on UAP):
|
||||||
|
*
|
||||||
|
* Medium Rectangle 300x250
|
||||||
|
* Rectangle 180x150
|
||||||
|
* Leaderboard 728x90
|
||||||
|
* Wide Skyscraper 160x600
|
||||||
|
*
|
||||||
|
* @category Plugin
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
|
* @author Evan Prodromou <evan@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/
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract class UAPPlugin extends Plugin
|
||||||
|
{
|
||||||
|
public $mediumRectangle = null;
|
||||||
|
public $rectangle = null;
|
||||||
|
public $leaderboard = null;
|
||||||
|
public $wideSkyscraper = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output our dedicated stylesheet
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return boolean hook flag
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onEndShowStatusNetStyles($action)
|
||||||
|
{
|
||||||
|
// XXX: allow override by theme
|
||||||
|
$action->cssLink('css/uap.css', 'base', 'screen, projection, tv');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a medium rectangle ad at the beginning of sidebar
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return boolean hook flag
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onStartShowAside($action)
|
||||||
|
{
|
||||||
|
if (!is_null($this->mediumRectangle)) {
|
||||||
|
|
||||||
|
$action->elementStart('div',
|
||||||
|
array('id' => 'ad_medium-rectangle',
|
||||||
|
'class' => 'ad'));
|
||||||
|
|
||||||
|
$this->showMediumRectangle($action);
|
||||||
|
|
||||||
|
$action->elementEnd('div');
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a leaderboard in the header
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return boolean hook flag
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onEndShowHeader($action)
|
||||||
|
{
|
||||||
|
if (!is_null($this->leaderboard)) {
|
||||||
|
$action->elementStart('div',
|
||||||
|
array('id' => 'ad_leaderboard',
|
||||||
|
'class' => 'ad'));
|
||||||
|
$this->showLeaderboard($action);
|
||||||
|
$action->elementEnd('div');
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a rectangle before aside sections
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return boolean hook flag
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onStartShowSections($action)
|
||||||
|
{
|
||||||
|
if (!is_null($this->rectangle)) {
|
||||||
|
$action->elementStart('div',
|
||||||
|
array('id' => 'ad_rectangle',
|
||||||
|
'class' => 'ad'));
|
||||||
|
$this->showRectangle($action);
|
||||||
|
$action->elementEnd('div');
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a wide skyscraper after the aside
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return boolean hook flag
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onEndShowAside($action)
|
||||||
|
{
|
||||||
|
if (!is_null($this->wideSkyscraper)) {
|
||||||
|
$action->elementStart('div',
|
||||||
|
array('id' => 'ad_wide-skyscraper',
|
||||||
|
'class' => 'ad'));
|
||||||
|
|
||||||
|
$this->showWideSkyscraper($action);
|
||||||
|
|
||||||
|
$action->elementEnd('div');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a medium rectangle ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract protected function showMediumRectangle($action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a rectangle ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract protected function showRectangle($action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a wide skyscraper ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract protected function showWideSkyscraper($action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a leaderboard ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract protected function showLeaderboard($action);
|
||||||
|
}
|
160
plugins/Adsense/AdsensePlugin.php
Normal file
160
plugins/Adsense/AdsensePlugin.php
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
|
*
|
||||||
|
* Plugin for Google Adsense
|
||||||
|
*
|
||||||
|
* 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 Ads
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @copyright 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin to add Google Adsense to StatusNet sites
|
||||||
|
*
|
||||||
|
* This plugin lets you add Adsense ad units to your StatusNet site.
|
||||||
|
*
|
||||||
|
* We support the 4 ad sizes for the Universal Ad Platform (UAP):
|
||||||
|
*
|
||||||
|
* Medium Rectangle
|
||||||
|
* (Small) Rectangle
|
||||||
|
* Leaderboard
|
||||||
|
* Wide Skyscraper
|
||||||
|
*
|
||||||
|
* They fit in different places on the default theme. Some themes
|
||||||
|
* might interact quite poorly with this plugin.
|
||||||
|
*
|
||||||
|
* To enable advertising, you must sign up with Google Adsense and
|
||||||
|
* get a client ID.
|
||||||
|
*
|
||||||
|
* https://www.google.com/adsense/
|
||||||
|
*
|
||||||
|
* You'll also need to create an Adsense for Content unit in one
|
||||||
|
* of the four sizes described above. At the end of the process,
|
||||||
|
* note the "google_ad_client" and "google_ad_slot" values in the
|
||||||
|
* resultant Javascript.
|
||||||
|
*
|
||||||
|
* Add the plugin to config.php like so:
|
||||||
|
*
|
||||||
|
* addPlugin('Adsense', array('client' => 'Your client ID',
|
||||||
|
* 'rectangle' => 'slot'));
|
||||||
|
*
|
||||||
|
* Here, your client ID is the value of google_ad_client and the
|
||||||
|
* slot is the value of google_ad_slot. Note that if you create
|
||||||
|
* a different size, you'll need to provide different arguments:
|
||||||
|
* 'mediumRectangle', 'leaderboard', or 'wideSkyscraper'.
|
||||||
|
*
|
||||||
|
* If for some reason your ad server is different from the default,
|
||||||
|
* use the 'adScript' parameter to set the full path to the ad script.
|
||||||
|
*
|
||||||
|
* @category Plugin
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@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/
|
||||||
|
*
|
||||||
|
* @seeAlso UAPPlugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
class AdsensePlugin extends UAPPlugin
|
||||||
|
{
|
||||||
|
public $adScript = 'http://pagead2.googlesyndication.com/pagead/show_ads.js';
|
||||||
|
public $client = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a medium rectangle 'ad'
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showMediumRectangle($action)
|
||||||
|
{
|
||||||
|
$this->showAdsenseCode($action, 300, 250, $this->mediumRectangle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a rectangle 'ad'
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showRectangle($action)
|
||||||
|
{
|
||||||
|
$this->showAdsenseCode($action, 180, 150, $this->rectangle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a wide skyscraper ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showWideSkyscraper($action)
|
||||||
|
{
|
||||||
|
$this->showAdsenseCode($action, 160, 600, $this->wideSkyscraper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a leaderboard ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showLeaderboard($action)
|
||||||
|
{
|
||||||
|
$this->showAdsenseCode($action, 728, 90, $this->leaderboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the bits of JavaScript code to show Adsense
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
* @param integer $width Width of the block
|
||||||
|
* @param integer $height Height of the block
|
||||||
|
* @param string $slot Slot identifier
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showAdsenseCode($action, $width, $height, $slot)
|
||||||
|
{
|
||||||
|
$code = 'google_ad_client = "'.$this->client.'"; ';
|
||||||
|
$code .= 'google_ad_slot = "'.$slot.'"; ';
|
||||||
|
$code .= 'google_ad_width = '.$width.'; ';
|
||||||
|
$code .= 'google_ad_height = '.$height.'; ';
|
||||||
|
|
||||||
|
$action->inlineScript($code);
|
||||||
|
|
||||||
|
$action->script($this->adScript);
|
||||||
|
}
|
||||||
|
}
|
124
plugins/BlankAd/BlankAdPlugin.php
Normal file
124
plugins/BlankAd/BlankAdPlugin.php
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
|
*
|
||||||
|
* Plugin for testing ad layout
|
||||||
|
*
|
||||||
|
* 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 Ads
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @copyright 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin for testing ad layout
|
||||||
|
*
|
||||||
|
* This plugin uses the UAPPlugin framework to output ad content. However,
|
||||||
|
* its ad content is just images with one red pixel stretched to the
|
||||||
|
* right size. It's mostly useful for debugging theme layout.
|
||||||
|
*
|
||||||
|
* To use this plugin, set the parameter for the ad size you want to use
|
||||||
|
* to true (or anything non-null). For example, to make a leaderboard:
|
||||||
|
*
|
||||||
|
* addPlugin('BlankAd', array('leaderboard' => true));
|
||||||
|
*
|
||||||
|
* @category Plugin
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@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/
|
||||||
|
*
|
||||||
|
* @seeAlso Location
|
||||||
|
*/
|
||||||
|
|
||||||
|
class BlankAdPlugin extends UAPPlugin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show a medium rectangle 'ad'
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showMediumRectangle($action)
|
||||||
|
{
|
||||||
|
$action->element('img',
|
||||||
|
array('width' => 300,
|
||||||
|
'height' => 250,
|
||||||
|
'src' => common_path('plugins/BlankAd/redpixel.png')),
|
||||||
|
'');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a rectangle 'ad'
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showRectangle($action)
|
||||||
|
{
|
||||||
|
$action->element('img',
|
||||||
|
array('width' => 180,
|
||||||
|
'height' => 150,
|
||||||
|
'src' => common_path('plugins/BlankAd/redpixel.png')),
|
||||||
|
'');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a wide skyscraper ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showWideSkyscraper($action)
|
||||||
|
{
|
||||||
|
$action->element('img',
|
||||||
|
array('width' => 160,
|
||||||
|
'height' => 600,
|
||||||
|
'src' => common_path('plugins/BlankAd/redpixel.png')),
|
||||||
|
'');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a leaderboard ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showLeaderboard($action)
|
||||||
|
{
|
||||||
|
$action->element('img',
|
||||||
|
array('width' => 728,
|
||||||
|
'height' => 90,
|
||||||
|
'src' => common_path('plugins/BlankAd/redpixel.png')),
|
||||||
|
'');
|
||||||
|
}
|
||||||
|
}
|
BIN
plugins/BlankAd/redpixel.png
Normal file
BIN
plugins/BlankAd/redpixel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 159 B |
165
plugins/OpenX/OpenXPlugin.php
Normal file
165
plugins/OpenX/OpenXPlugin.php
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
|
*
|
||||||
|
* Plugin for OpenX ad server
|
||||||
|
*
|
||||||
|
* 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 Ads
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @copyright 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin for OpenX Ad Server
|
||||||
|
*
|
||||||
|
* This plugin supports the OpenX ad server, http://www.openx.org/
|
||||||
|
*
|
||||||
|
* We support the 4 ad sizes for the Universal Ad Platform (UAP):
|
||||||
|
*
|
||||||
|
* Medium Rectangle
|
||||||
|
* (Small) Rectangle
|
||||||
|
* Leaderboard
|
||||||
|
* Wide Skyscraper
|
||||||
|
*
|
||||||
|
* They fit in different places on the default theme. Some themes
|
||||||
|
* might interact quite poorly with this plugin.
|
||||||
|
*
|
||||||
|
* To enable advertising, you will need an OpenX server. You'll need
|
||||||
|
* to set up a "zone" for your StatusNet site that identifies a
|
||||||
|
* kind of ad you want to place (of the above 4 sizes).
|
||||||
|
*
|
||||||
|
* Add the plugin to config.php like so:
|
||||||
|
*
|
||||||
|
* addPlugin('OpenX', array('adScript' => 'full path to script',
|
||||||
|
* 'rectangle' => 1));
|
||||||
|
*
|
||||||
|
* Here, the 'adScript' parameter is the full path to the OpenX
|
||||||
|
* ad script, like 'http://example.com/www/delivery/ajs.php'. Note
|
||||||
|
* that we don't do any magic to swap between HTTP and HTTPS, so
|
||||||
|
* if you want HTTPS, say so.
|
||||||
|
*
|
||||||
|
* The 'rectangle' parameter is the zone ID for that ad space on
|
||||||
|
* your site. If you've configured another size, try 'mediumRectangle',
|
||||||
|
* 'leaderboard', or 'wideSkyscraper'.
|
||||||
|
*
|
||||||
|
* If for some reason your ad server is different from the default,
|
||||||
|
* use the 'adScript' parameter to set the full path to the ad script.
|
||||||
|
*
|
||||||
|
* @category Ads
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@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/
|
||||||
|
*
|
||||||
|
* @seeAlso UAPPlugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
class OpenXPlugin extends UAPPlugin
|
||||||
|
{
|
||||||
|
public $adScript = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a medium rectangle 'ad'
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showMediumRectangle($action)
|
||||||
|
{
|
||||||
|
$this->showAd($action, $this->mediumRectangle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a rectangle 'ad'
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showRectangle($action)
|
||||||
|
{
|
||||||
|
$this->showAd($action, $this->rectangle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a wide skyscraper ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showWideSkyscraper($action)
|
||||||
|
{
|
||||||
|
$this->showAd($action, $this->wideSkyscraper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a leaderboard ad
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showLeaderboard($action)
|
||||||
|
{
|
||||||
|
$this->showAd($action, $this->leaderboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show an ad using OpenX
|
||||||
|
*
|
||||||
|
* @param Action $action Action being shown
|
||||||
|
* @param integer $zone Zone to show
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected function showAd($action, $zone)
|
||||||
|
{
|
||||||
|
$scr = <<<ENDOFSCRIPT
|
||||||
|
var m3_u = '%s';
|
||||||
|
var m3_r = Math.floor(Math.random()*99999999999);
|
||||||
|
if (!document.MAX_used) document.MAX_used = ',';
|
||||||
|
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
|
||||||
|
document.write ("?zoneid=%d");
|
||||||
|
document.write ('&cb=' + m3_r);
|
||||||
|
if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used);
|
||||||
|
document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));
|
||||||
|
document.write ("&loc=" + escape(window.location));
|
||||||
|
if (document.referrer) document.write ("&referer=" + escape(document.referrer));
|
||||||
|
if (document.context) document.write ("&context=" + escape(document.context));
|
||||||
|
if (document.mmm_fo) document.write ("&mmm_fo=1");
|
||||||
|
document.write ("'><\/scr"+"ipt>");
|
||||||
|
ENDOFSCRIPT;
|
||||||
|
|
||||||
|
$action->inlineScript(sprintf($scr, $this->adScript, $zone));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
82
scripts/sendemail.php
Executable file
82
scripts/sendemail.php
Executable file
@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* StatusNet - a distributed open-source microblogging tool
|
||||||
|
* Copyright (C) 2008, 2009, StatusNet, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
|
||||||
|
|
||||||
|
$shortoptions = 'i:n:';
|
||||||
|
$longoptions = array('id=', 'nickname=', 'subject=');
|
||||||
|
|
||||||
|
$helptext = <<<END_OF_USEREMAIL_HELP
|
||||||
|
sendemail.php [options] < <message body>
|
||||||
|
Sends given email text to user.
|
||||||
|
|
||||||
|
-i --id id of the user to query
|
||||||
|
-n --nickname nickname of the user to query
|
||||||
|
--subject mail subject line (required)
|
||||||
|
|
||||||
|
END_OF_USEREMAIL_HELP;
|
||||||
|
|
||||||
|
require_once INSTALLDIR.'/scripts/commandline.inc';
|
||||||
|
|
||||||
|
if (have_option('i', 'id')) {
|
||||||
|
$id = get_option_value('i', 'id');
|
||||||
|
$user = User::staticGet('id', $id);
|
||||||
|
if (empty($user)) {
|
||||||
|
print "Can't find user with ID $id\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
} else if (have_option('n', 'nickname')) {
|
||||||
|
$nickname = get_option_value('n', 'nickname');
|
||||||
|
$user = User::staticGet('nickname', $nickname);
|
||||||
|
if (empty($user)) {
|
||||||
|
print "Can't find user with nickname '$nickname'\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "You must provide a user by --id or --nickname\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($user->email)) {
|
||||||
|
// @fixme unconfirmed address?
|
||||||
|
print "No email registered for user '$user->nickname'\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!have_option('subject')) {
|
||||||
|
echo "You must provide a subject line for the mail in --subject='...' param.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
$subject = get_option_value('subject');
|
||||||
|
|
||||||
|
if (posix_isatty(STDIN)) {
|
||||||
|
print "You must provide message input on stdin!\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
$body = file_get_contents('php://stdin');
|
||||||
|
|
||||||
|
print "Sending to $user->email...";
|
||||||
|
if (mail_to_user($user, $subject, $body)) {
|
||||||
|
print " done\n";
|
||||||
|
} else {
|
||||||
|
print " failed.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
@ -11,4 +11,8 @@ export AVATARBASE=/var/www/avatar.example.net
|
|||||||
export BACKGROUNDBASE=/var/www/background.example.net
|
export BACKGROUNDBASE=/var/www/background.example.net
|
||||||
export FILEBASE=/var/www/file.example.net
|
export FILEBASE=/var/www/file.example.net
|
||||||
export PWDGEN="pwgen 20"
|
export PWDGEN="pwgen 20"
|
||||||
|
export PHPBASE=/var/www/statusnet
|
||||||
|
export WILDCARD=example.net
|
||||||
|
export MAILTEMPLATE=/etc/statusnet/newsite-mail.txt
|
||||||
|
export MAILSUBJECT="Your new StatusNet site"
|
||||||
|
export POSTINSTALL=/etc/statusnet/morestuff.sh
|
||||||
|
@ -2,9 +2,23 @@
|
|||||||
|
|
||||||
source /etc/statusnet/setup.cfg
|
source /etc/statusnet/setup.cfg
|
||||||
|
|
||||||
export nickname=$1
|
# setup_status_net.sh mysite 'My Site' '1user' 'owner@example.com' 'Firsty McLastname'
|
||||||
export sitename=$2
|
|
||||||
|
|
||||||
|
export nickname="$1"
|
||||||
|
export sitename="$2"
|
||||||
|
export tags="$3"
|
||||||
|
export email="$4"
|
||||||
|
export fullname="$5"
|
||||||
|
|
||||||
|
# Fixme: if this is changed later we need to update profile URLs
|
||||||
|
# for the created user.
|
||||||
|
export server="$nickname.$WILDCARD"
|
||||||
|
|
||||||
|
# End-user info
|
||||||
|
export userpass=`$PWDGEN`
|
||||||
|
export roles="administrator moderator owner"
|
||||||
|
|
||||||
|
# DB info
|
||||||
export password=`$PWDGEN`
|
export password=`$PWDGEN`
|
||||||
export database=$nickname$DBBASE
|
export database=$nickname$DBBASE
|
||||||
export username=$nickname$USERBASE
|
export username=$nickname$USERBASE
|
||||||
@ -21,8 +35,8 @@ mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS
|
|||||||
|
|
||||||
GRANT ALL ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password';
|
GRANT ALL ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password';
|
||||||
GRANT ALL ON $database.* TO '$username'@'%' IDENTIFIED BY '$password';
|
GRANT ALL ON $database.* TO '$username'@'%' IDENTIFIED BY '$password';
|
||||||
INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created)
|
INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created, tags)
|
||||||
VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now());
|
VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now(), '$tags');
|
||||||
|
|
||||||
ENDOFCOMMANDS
|
ENDOFCOMMANDS
|
||||||
|
|
||||||
@ -30,3 +44,39 @@ for top in $AVATARBASE $FILEBASE $BACKGROUNDBASE; do
|
|||||||
mkdir $top/$nickname
|
mkdir $top/$nickname
|
||||||
chmod a+w $top/$nickname
|
chmod a+w $top/$nickname
|
||||||
done
|
done
|
||||||
|
|
||||||
|
php $PHPBASE/scripts/registeruser.php \
|
||||||
|
-s"$server" \
|
||||||
|
-n"$nickname" \
|
||||||
|
-f"$fullname" \
|
||||||
|
-w"$userpass" \
|
||||||
|
-e"$email"
|
||||||
|
|
||||||
|
for role in $roles
|
||||||
|
do
|
||||||
|
php $PHPBASE/scripts/userrole.php \
|
||||||
|
-s"$server" \
|
||||||
|
-n"$nickname" \
|
||||||
|
-r"$role"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -f "$MAILTEMPLATE" ]
|
||||||
|
then
|
||||||
|
# fixme how safe is this? are sitenames sanitized?
|
||||||
|
cat $MAILTEMPLATE | \
|
||||||
|
sed "s/\$nickname/$nickname/" | \
|
||||||
|
sed "s/\$sitename/$sitename/" | \
|
||||||
|
sed "s/\$userpass/$userpass/" | \
|
||||||
|
php $PHPBASE/scripts/sendemail.php \
|
||||||
|
-s"$server" \
|
||||||
|
-n"$nickname" \
|
||||||
|
--subject="$MAILSUBJECT"
|
||||||
|
else
|
||||||
|
echo "No mail template, not sending email."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$POSTINSTALL" ]
|
||||||
|
then
|
||||||
|
echo "Running $POSTINSTALL ..."
|
||||||
|
source "$POSTINSTALL"
|
||||||
|
fi
|
||||||
|
51
theme/README
51
theme/README
@ -2,37 +2,46 @@
|
|||||||
*
|
*
|
||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @copyright 2009 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Location of key paths and files under theme/:
|
== Location of key paths and files ==
|
||||||
|
<pre><nowiki>
|
||||||
|
base/css/
|
||||||
|
base/css/display.css #layout, typography rules
|
||||||
|
base/images/ #common icons, illustrations
|
||||||
|
base/images/icons/icons-01.png #main icons file (combined into a single file)
|
||||||
|
|
||||||
./base/css/
|
default/css/
|
||||||
./base/css/display.css
|
default/css/display.css #imports the base stylesheet for layout and adds background images and colour rules
|
||||||
./base/images/
|
default/logo.png #default site logo for this theme
|
||||||
|
default/mobilelogo.png #default logo for the mobile output
|
||||||
|
default/default-avatar-mini.png #24x24 default avatar for minilists
|
||||||
|
default/default-avatar-stream.png #48x48 default avatar for notice timelines
|
||||||
|
default/default-avatar-profile.png #96x96 default avatar for the profile page
|
||||||
|
</nowiki></pre>
|
||||||
|
|
||||||
./default/css/
|
|
||||||
./default/css/display.css
|
|
||||||
./default/images/
|
|
||||||
|
|
||||||
./base/display.css contains layout, typography rules:
|
== How to create your own theme ==
|
||||||
Only alter this file if you want to change the layout of the site. Please note that, any updates to this in future statusnet releases may not be compatible with your version.
|
|
||||||
|
|
||||||
./default/css/display.css contains only the background images and colour rules:
|
|
||||||
This file is a good basis for creating your own theme.
|
|
||||||
|
|
||||||
Let's create a theme:
|
You probably want to do one of the following:
|
||||||
|
|
||||||
1. To start off, copy over the default theme:
|
|
||||||
cp -r default mytheme
|
|
||||||
|
|
||||||
2. Edit your mytheme stylesheet:
|
* If you just want to change the text, link, background, content, sidebar colours, background image:
|
||||||
nano mytheme/css/display.css
|
** Do this from the Admin->Design settings (recommended!). You could also create a directory and a file structure like the default theme, search and replace with your own values. This is more work, but, you can do this if you plan to make additional *minimal* changes.
|
||||||
|
|
||||||
a) Search and replace your colours and background images, or
|
|
||||||
b) Create your own layout either importing a separate stylesheet (e.g., change to @import url(base.css);) or simply place it before the rest of the rules.
|
|
||||||
|
|
||||||
4. Set /config.php to load 'mytheme':
|
* If you want to change the background images and colours:
|
||||||
$config['site']['theme'] = 'mytheme';
|
# Create a directory and a file structure like the default theme.
|
||||||
|
# Have your stylesheet import base/css/display.css and add your own styles below. It is okay to add *minimal* changes here.
|
||||||
|
|
||||||
|
|
||||||
|
* If you want to create a different layout, typography, background images and colours:
|
||||||
|
** Create your own theme directory (base or default) with stylesheets and images like.
|
||||||
|
|
||||||
|
|
||||||
|
Finally, enable your theme by selecting it from the Admin->Design interface. You can set site's logo from here as well.
|
||||||
|
|
||||||
|
54
theme/base/css/uap.css
Normal file
54
theme/base/css/uap.css
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/** Universal Ad Package styles:
|
||||||
|
* Medium Rectangle 300x250
|
||||||
|
* Rectangle 180x150
|
||||||
|
* Leaderboard 728x90
|
||||||
|
* Wide Skyscraper 160x600
|
||||||
|
*
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
|
* @copyright 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/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
.ad {
|
||||||
|
border:1px solid #CCC;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ad_medium-rectangle {
|
||||||
|
width:300px;
|
||||||
|
height:250px;
|
||||||
|
|
||||||
|
margin-left:1.35%;
|
||||||
|
margin-bottom:18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ad_rectangle {
|
||||||
|
width:180px;
|
||||||
|
height:150px;
|
||||||
|
|
||||||
|
float:none;
|
||||||
|
clear:both;
|
||||||
|
margin:0 auto;
|
||||||
|
margin-bottom:29px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ad_leaderboard {
|
||||||
|
width:728px;
|
||||||
|
height:90px;
|
||||||
|
|
||||||
|
margin:0 auto 18px;
|
||||||
|
float:none;
|
||||||
|
clear:both;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ad_wide-skyscraper {
|
||||||
|
width:160px;
|
||||||
|
height:600px;
|
||||||
|
|
||||||
|
float:right;
|
||||||
|
margin-top:18px;
|
||||||
|
margin-right:8.25%;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user