forked from GNUsocial/gnu-social
[CORE] Plugin API now extends a new Module API
This commit is contained in:
parent
b6e7b18c7b
commit
0c2c3ec862
@ -223,10 +223,10 @@ function onEndPrimaryNav($action)
|
||||
return true;
|
||||
}
|
||||
|
||||
function onPluginVersion(&$versions)
|
||||
public function onPluginVersion(&$versions): bool
|
||||
{
|
||||
$versions[] = array('name' => 'Sample',
|
||||
'version' => STATUSNET_VERSION,
|
||||
'version' => GNUSOCIAL_VERSION,
|
||||
'author' => 'Brion Vibber, Evan Prodromou',
|
||||
'homepage' => 'http://example.org/plugin',
|
||||
'rawdescription' =>
|
||||
|
@ -72,7 +72,7 @@ class VersionAction extends Action
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
Event::handle('PluginVersion', array(&$this->pluginVersions));
|
||||
Event::handle('PluginVersion', [&$this->pluginVersions]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -106,6 +106,7 @@ require_once INSTALLDIR . '/lib/language.php';
|
||||
// can use it
|
||||
|
||||
require_once INSTALLDIR . '/lib/event.php';
|
||||
require_once INSTALLDIR . '/lib/modules/Module.php';
|
||||
require_once INSTALLDIR . '/lib/modules/Plugin.php';
|
||||
|
||||
function addPlugin($name, array $attrs = [])
|
||||
|
@ -27,10 +27,66 @@ class GNUsocial
|
||||
protected static $have_config;
|
||||
protected static $is_api;
|
||||
protected static $is_ajax;
|
||||
protected static $plugins = [];
|
||||
protected static $modules = [];
|
||||
|
||||
/**
|
||||
* Configure and instantiate a plugin (or a core module) into the current configuration.
|
||||
* Configure and instantiate a core module into the current configuration.
|
||||
* Class definitions will be loaded from standard paths if necessary.
|
||||
* Note that initialization events won't be fired until later.
|
||||
*
|
||||
* @param string $name class name & module file/subdir name
|
||||
* @param array $attrs key/value pairs of public attributes to set on module instance
|
||||
*
|
||||
* @return bool
|
||||
* @throws ServerException if module can't be found
|
||||
*/
|
||||
public static function addModule(string $name, array $attrs = [])
|
||||
{
|
||||
$name = ucfirst($name);
|
||||
|
||||
if (isset(self::$modules[$name])) {
|
||||
// We have already loaded this module. Don't try to
|
||||
// do it again with (possibly) different values.
|
||||
// Försten till kvarn får mala.
|
||||
return true;
|
||||
}
|
||||
|
||||
$moduleclass = "{$name}Module";
|
||||
|
||||
if (!class_exists($moduleclass)) {
|
||||
|
||||
$files = [
|
||||
"modules/{$moduleclass}.php",
|
||||
"modules/{$name}/{$moduleclass}.php"
|
||||
];
|
||||
|
||||
foreach ($files as $file) {
|
||||
$fullpath = INSTALLDIR . '/' . $file;
|
||||
if (@file_exists($fullpath)) {
|
||||
include_once $fullpath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!class_exists($moduleclass)) {
|
||||
throw new ServerException("Module $name not found.", 500);
|
||||
}
|
||||
}
|
||||
|
||||
// Doesn't this $inst risk being garbage collected or something?
|
||||
// TODO: put into a static array that makes sure $inst isn't lost.
|
||||
$inst = new $moduleclass();
|
||||
foreach ($attrs as $aname => $avalue) {
|
||||
$inst->$aname = $avalue;
|
||||
}
|
||||
|
||||
// Record activated modules for later display/config dump
|
||||
self::$modules[$name] = $attrs;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure and instantiate a plugin into the current configuration.
|
||||
* Class definitions will be loaded from standard paths if necessary.
|
||||
* Note that initialization events won't be fired until later.
|
||||
*
|
||||
@ -44,7 +100,7 @@ class GNUsocial
|
||||
{
|
||||
$name = ucfirst($name);
|
||||
|
||||
if (isset(self::$plugins[$name])) {
|
||||
if (isset(self::$modules[$name])) {
|
||||
// We have already loaded this module. Don't try to
|
||||
// do it again with (possibly) different values.
|
||||
// Försten till kvarn får mala.
|
||||
@ -58,8 +114,6 @@ class GNUsocial
|
||||
$files = [
|
||||
"local/plugins/{$moduleclass}.php",
|
||||
"local/plugins/{$name}/{$moduleclass}.php",
|
||||
"modules/{$moduleclass}.php",
|
||||
"modules/{$name}/{$moduleclass}.php",
|
||||
"plugins/{$moduleclass}.php",
|
||||
"plugins/{$name}/{$moduleclass}.php"
|
||||
];
|
||||
@ -67,7 +121,7 @@ class GNUsocial
|
||||
foreach ($files as $file) {
|
||||
$fullpath = INSTALLDIR . '/' . $file;
|
||||
if (@file_exists($fullpath)) {
|
||||
include_once($fullpath);
|
||||
include_once $fullpath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -84,7 +138,7 @@ class GNUsocial
|
||||
}
|
||||
|
||||
// Record activated modules for later display/config dump
|
||||
self::$plugins[$name] = $attrs;
|
||||
self::$modules[$name] = $attrs;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -93,8 +147,8 @@ class GNUsocial
|
||||
{
|
||||
// Remove our module if it was previously loaded
|
||||
$name = ucfirst($name);
|
||||
if (isset(self::$plugins[$name])) {
|
||||
unset(self::$plugins[$name]);
|
||||
if (isset(self::$modules[$name])) {
|
||||
unset(self::$modules[$name]);
|
||||
}
|
||||
|
||||
// make sure initPlugins will avoid this
|
||||
@ -107,9 +161,9 @@ class GNUsocial
|
||||
* Get a list of activated modules in this process.
|
||||
* @return array of (string $name, array $args) pairs
|
||||
*/
|
||||
public static function getActivePlugins()
|
||||
public static function getActiveModules()
|
||||
{
|
||||
return self::$plugins;
|
||||
return self::$modules;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,7 +199,7 @@ class GNUsocial
|
||||
self::fillConfigVoids();
|
||||
self::verifyLoadedConfig();
|
||||
|
||||
self::initPlugins();
|
||||
self::initModules();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -206,9 +260,9 @@ class GNUsocial
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire initialization events for all instantiated plugins.
|
||||
* Fire initialization events for all instantiated modules.
|
||||
*/
|
||||
protected static function initPlugins()
|
||||
protected static function initModules()
|
||||
{
|
||||
// User config may have already added some of these modules, with
|
||||
// maybe configured parameters. The self::addModule function will
|
||||
@ -216,7 +270,7 @@ class GNUsocial
|
||||
|
||||
// Load core modules
|
||||
foreach (common_config('plugins', 'core') as $name => $params) {
|
||||
call_user_func('self::addPlugin', $name, $params);
|
||||
call_user_func('self::addModule', $name, $params);
|
||||
}
|
||||
|
||||
// Load default plugins
|
||||
@ -245,7 +299,8 @@ class GNUsocial
|
||||
Event::handle('CheckSchema');
|
||||
}
|
||||
|
||||
// Give modules a chance to initialize in a fully-prepared environment
|
||||
// Give modules and plugins a chance to initialize in a fully-prepared environment
|
||||
Event::handle('InitializeModule');
|
||||
Event::handle('InitializePlugin');
|
||||
}
|
||||
|
||||
@ -310,7 +365,7 @@ class GNUsocial
|
||||
global $_server, $_path, $config, $_PEAR;
|
||||
|
||||
Event::clearHandlers();
|
||||
self::$plugins = [];
|
||||
self::$modules = [];
|
||||
|
||||
// try to figure out where we are. $server and $path
|
||||
// can be set by including module, else we guess based
|
||||
|
640
lib/modules/ActivityHandlerModule.php
Normal file
640
lib/modules/ActivityHandlerModule.php
Normal file
@ -0,0 +1,640 @@
|
||||
<?php
|
||||
/*
|
||||
* GNU Social - a federating social network
|
||||
* Copyright (C) 2014, Free Software Foundation, 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('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
/**
|
||||
* Superclass for plugins which add Activity types and such
|
||||
*
|
||||
* @category Activity
|
||||
* @package GNUsocial
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @copyright 2014 Free Software Foundation, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://gnu.io/social
|
||||
*/
|
||||
abstract class ActivityHandlerModule extends Module
|
||||
{
|
||||
/**
|
||||
* Returns a key string which represents this activity in HTML classes,
|
||||
* ids etc, as when offering selection of what type of post to make.
|
||||
* In MicroAppPlugin, this is paired with the user-visible localizable appTitle().
|
||||
*
|
||||
* @return string (compatible with HTML classes)
|
||||
*/
|
||||
abstract function tag();
|
||||
|
||||
/**
|
||||
* Return a list of ActivityStreams object type IRIs
|
||||
* which this micro-app handles. Default implementations
|
||||
* of the base class will use this list to check if a
|
||||
* given ActivityStreams object belongs to us, via
|
||||
* $this->isMyNotice() or $this->isMyActivity.
|
||||
*
|
||||
* An empty list means any type is ok. (Favorite verb etc.)
|
||||
*
|
||||
* @return array of strings
|
||||
*/
|
||||
abstract function types();
|
||||
|
||||
/**
|
||||
* Return a list of ActivityStreams verb IRIs which
|
||||
* this micro-app handles. Default implementations
|
||||
* of the base class will use this list to check if a
|
||||
* given ActivityStreams verb belongs to us, via
|
||||
* $this->isMyNotice() or $this->isMyActivity.
|
||||
*
|
||||
* All micro-app classes must override this method.
|
||||
*
|
||||
* @return array of strings
|
||||
*/
|
||||
public function verbs() {
|
||||
return array(ActivityVerb::POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given ActivityStreams activity should be handled by this
|
||||
* micro-app plugin.
|
||||
*
|
||||
* The default implementation checks against the activity type list
|
||||
* returned by $this->types(), and requires that exactly one matching
|
||||
* object be present. You can override this method to expand
|
||||
* your checks or to compare the activity's verb, etc.
|
||||
*
|
||||
* @param Activity $activity
|
||||
* @return boolean
|
||||
*/
|
||||
function isMyActivity(Activity $act) {
|
||||
return (count($act->objects) == 1
|
||||
&& ($act->objects[0] instanceof ActivityObject)
|
||||
&& $this->isMyVerb($act->verb)
|
||||
&& $this->isMyType($act->objects[0]->type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given notice object should be handled by this micro-app
|
||||
* plugin.
|
||||
*
|
||||
* The default implementation checks against the activity type list
|
||||
* returned by $this->types(). You can override this method to expand
|
||||
* your checks, but follow the execution chain to get it right.
|
||||
*
|
||||
* @param Notice $notice
|
||||
* @return boolean
|
||||
*/
|
||||
function isMyNotice(Notice $notice) {
|
||||
return $this->isMyVerb($notice->verb) && $this->isMyType($notice->object_type);
|
||||
}
|
||||
|
||||
function isMyVerb($verb) {
|
||||
$verb = $verb ?: ActivityVerb::POST; // post is the default verb
|
||||
return ActivityUtils::compareVerbs($verb, $this->verbs());
|
||||
}
|
||||
|
||||
function isMyType($type) {
|
||||
// Third argument to compareTypes is true, to allow for notices with empty object_type for example (verb-only)
|
||||
return count($this->types())===0 || ActivityUtils::compareTypes($type, $this->types());
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a parsed ActivityStreams activity, your plugin
|
||||
* gets to figure out how to actually save it into a notice
|
||||
* and any additional data structures you require.
|
||||
*
|
||||
* This function is deprecated and in the future, Notice::saveActivity
|
||||
* should be called from onStartHandleFeedEntryWithProfile in this class
|
||||
* (which instead turns to saveObjectFromActivity).
|
||||
*
|
||||
* @param Activity $activity
|
||||
* @param Profile $actor
|
||||
* @param array $options=array()
|
||||
*
|
||||
* @return Notice the resulting notice
|
||||
*/
|
||||
public function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
|
||||
{
|
||||
// Any plugin which has not implemented saveObjectFromActivity _must_
|
||||
// override this function until they are migrated (this function will
|
||||
// be deleted when all plugins are migrated to saveObjectFromActivity).
|
||||
|
||||
if (isset($this->oldSaveNew)) {
|
||||
throw new ServerException('A function has been called for new saveActivity functionality, but is still set with an oldSaveNew configuration');
|
||||
}
|
||||
|
||||
return Notice::saveActivity($activity, $actor, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a parsed ActivityStreams activity, your plugin gets
|
||||
* to figure out itself how to store the additional data into
|
||||
* the database, besides the base data stored by the core.
|
||||
*
|
||||
* This will handle just about all events where an activity
|
||||
* object gets saved, whether it is via AtomPub, OStatus
|
||||
* (WebSub and Salmon transports), or ActivityStreams-based
|
||||
* backup/restore of account data.
|
||||
*
|
||||
* You should be able to accept as input the output from an
|
||||
* asActivity() call on the stored object. Where applicable,
|
||||
* try to use existing ActivityStreams structures and object
|
||||
* types, and be liberal in accepting input from what might
|
||||
* be other compatible apps.
|
||||
*
|
||||
* All micro-app classes must override this method.
|
||||
*
|
||||
* @fixme are there any standard options?
|
||||
*
|
||||
* @param Activity $activity
|
||||
* @param Notice $stored The notice in our database for this certain object
|
||||
* @param array $options=array()
|
||||
*
|
||||
* @return object If the verb handling plugin creates an object, it can be returned here (otherwise true)
|
||||
* @throws exception On any error.
|
||||
*/
|
||||
protected function saveObjectFromActivity(Activity $activity, Notice $stored, array $options=array())
|
||||
{
|
||||
throw new ServerException('This function should be abstract when all plugins have migrated to saveObjectFromActivity');
|
||||
}
|
||||
|
||||
/*
|
||||
* This usually gets called from Notice::saveActivity after a Notice object has been created,
|
||||
* so it contains a proper id and a uri for the object to be saved.
|
||||
*/
|
||||
public function onStoreActivityObject(Activity $act, Notice $stored, array $options, &$object) {
|
||||
// $this->oldSaveNew is there during a migration period of plugins, to start using
|
||||
// Notice::saveActivity instead of Notice::saveNew
|
||||
if (!$this->isMyActivity($act) || isset($this->oldSaveNew)) {
|
||||
return true;
|
||||
}
|
||||
$object = $this->saveObjectFromActivity($act, $stored, $options);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an existing Notice object, your plugin gets to
|
||||
* figure out how to arrange it into an ActivityStreams
|
||||
* object.
|
||||
*
|
||||
* This will be how your specialized notice gets output in
|
||||
* Atom feeds and JSON-based ActivityStreams output, including
|
||||
* account backup/restore and OStatus (WebSub and Salmon transports).
|
||||
*
|
||||
* You should be able to round-trip data from this format back
|
||||
* through $this->saveNoticeFromActivity(). Where applicable, try
|
||||
* to use existing ActivityStreams structures and object types,
|
||||
* and consider interop with other compatible apps.
|
||||
*
|
||||
* All micro-app classes must override this method.
|
||||
*
|
||||
* @fixme this outputs an ActivityObject, not an Activity. Any compat issues?
|
||||
*
|
||||
* @param Notice $notice
|
||||
*
|
||||
* @return ActivityObject
|
||||
*/
|
||||
abstract function activityObjectFromNotice(Notice $notice);
|
||||
|
||||
/**
|
||||
* When a notice is deleted, you'll be called here for a chance
|
||||
* to clean up any related resources.
|
||||
*
|
||||
* All micro-app classes must override this method.
|
||||
*
|
||||
* @param Notice $notice
|
||||
*/
|
||||
abstract function deleteRelated(Notice $notice);
|
||||
|
||||
protected function notifyMentioned(Notice $stored, array &$mentioned_ids)
|
||||
{
|
||||
// pass through silently by default
|
||||
|
||||
// If we want to stop any other plugin from notifying based on this activity, return false instead.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when generating Atom XML ActivityStreams output from an
|
||||
* ActivityObject belonging to this plugin. Gives the plugin
|
||||
* a chance to add custom output.
|
||||
*
|
||||
* Note that you can only add output of additional XML elements,
|
||||
* not change existing stuff here.
|
||||
*
|
||||
* If output is already handled by the base Activity classes,
|
||||
* you can leave this base implementation as a no-op.
|
||||
*
|
||||
* @param ActivityObject $obj
|
||||
* @param XMLOutputter $out to add elements at end of object
|
||||
*/
|
||||
function activityObjectOutputAtom(ActivityObject $obj, XMLOutputter $out)
|
||||
{
|
||||
// default is a no-op
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when generating JSON ActivityStreams output from an
|
||||
* ActivityObject belonging to this plugin. Gives the plugin
|
||||
* a chance to add custom output.
|
||||
*
|
||||
* Modify the array contents to your heart's content, and it'll
|
||||
* all get serialized out as JSON.
|
||||
*
|
||||
* If output is already handled by the base Activity classes,
|
||||
* you can leave this base implementation as a no-op.
|
||||
*
|
||||
* @param ActivityObject $obj
|
||||
* @param array &$out JSON-targeted array which can be modified
|
||||
*/
|
||||
public function activityObjectOutputJson(ActivityObject $obj, array &$out)
|
||||
{
|
||||
// default is a no-op
|
||||
}
|
||||
|
||||
/**
|
||||
* When a notice is deleted, delete the related objects
|
||||
* by calling the overridable $this->deleteRelated().
|
||||
*
|
||||
* @param Notice $notice Notice being deleted
|
||||
*
|
||||
* @return boolean hook value
|
||||
*/
|
||||
public function onNoticeDeleteRelated(Notice $notice)
|
||||
{
|
||||
if ($this->isMyNotice($notice)) {
|
||||
try {
|
||||
$this->deleteRelated($notice);
|
||||
} catch (NoProfileException $e) {
|
||||
// we failed because of database lookup failure, Notice has no recognized profile as creator
|
||||
// so we skip this. If we want to remove missing notices we should do a SQL constraints check
|
||||
// in the affected plugin.
|
||||
} catch (AlreadyFulfilledException $e) {
|
||||
// Nothing to see here, it's obviously already gone...
|
||||
}
|
||||
}
|
||||
|
||||
// Always continue this event in our activity handling plugins.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Notice $stored The notice being distributed
|
||||
* @param array &$mentioned_ids List of profiles (from $stored->getReplies())
|
||||
*/
|
||||
public function onStartNotifyMentioned(Notice $stored, array &$mentioned_ids)
|
||||
{
|
||||
if (!$this->isMyNotice($stored)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->notifyMentioned($stored, $mentioned_ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a notice as one of our objects
|
||||
*
|
||||
* @param Notice $notice Notice to render
|
||||
* @param ActivityObject &$object Empty object to fill
|
||||
*
|
||||
* @return boolean hook value
|
||||
*/
|
||||
function onStartActivityObjectFromNotice(Notice $notice, &$object)
|
||||
{
|
||||
if (!$this->isMyNotice($notice)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$object = $this->activityObjectFromNotice($notice);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a posted object from WebSub
|
||||
*
|
||||
* @param Activity $activity activity to handle
|
||||
* @param Profile $actor Profile for the feed
|
||||
*
|
||||
* @return boolean hook value
|
||||
*/
|
||||
function onStartHandleFeedEntryWithProfile(Activity $activity, Profile $profile, &$notice)
|
||||
{
|
||||
if (!$this->isMyActivity($activity)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// We are guaranteed to get a Profile back from checkAuthorship (or it throws an exception)
|
||||
$profile = ActivityUtils::checkAuthorship($activity, $profile);
|
||||
|
||||
$object = $activity->objects[0];
|
||||
|
||||
$options = array('uri' => $object->id,
|
||||
'url' => $object->link,
|
||||
'self' => $object->selfLink,
|
||||
'is_local' => Notice::REMOTE,
|
||||
'source' => 'ostatus');
|
||||
|
||||
if (!isset($this->oldSaveNew)) {
|
||||
$notice = Notice::saveActivity($activity, $profile, $options);
|
||||
} else {
|
||||
$notice = $this->saveNoticeFromActivity($activity, $profile, $options);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a posted object from Salmon
|
||||
*
|
||||
* @param Activity $activity activity to handle
|
||||
* @param mixed $target user or group targeted
|
||||
*
|
||||
* @return boolean hook value
|
||||
*/
|
||||
|
||||
function onStartHandleSalmonTarget(Activity $activity, $target)
|
||||
{
|
||||
if (!$this->isMyActivity($activity)) {
|
||||
return true;
|
||||
}
|
||||
if (!isset($this->oldSaveNew)) {
|
||||
// Handle saveActivity in OStatus class for incoming salmon, remove this event
|
||||
// handler when all plugins have gotten rid of "oldSaveNew".
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->log(LOG_INFO, get_called_class()." checking {$activity->id} as a valid Salmon slap.");
|
||||
|
||||
if ($target instanceof User_group || $target->isGroup()) {
|
||||
$uri = $target->getUri();
|
||||
if (!array_key_exists($uri, $activity->context->attention)) {
|
||||
// @todo FIXME: please document (i18n).
|
||||
// TRANS: Client exception thrown when ...
|
||||
throw new ClientException(_('Object not posted to this group.'));
|
||||
}
|
||||
} elseif ($target instanceof Profile && $target->isLocal()) {
|
||||
$original = null;
|
||||
// FIXME: Shouldn't favorites show up with a 'target' activityobject?
|
||||
if (!ActivityUtils::compareVerbs($activity->verb, array(ActivityVerb::POST)) && isset($activity->objects[0])) {
|
||||
// If this is not a post, it's a verb targeted at something (such as a Favorite attached to a note)
|
||||
if (!empty($activity->objects[0]->id)) {
|
||||
$activity->context->replyToID = $activity->objects[0]->id;
|
||||
}
|
||||
}
|
||||
if (!empty($activity->context->replyToID)) {
|
||||
$original = Notice::getKV('uri', $activity->context->replyToID);
|
||||
}
|
||||
if ((!$original instanceof Notice || $original->profile_id != $target->id)
|
||||
&& !array_key_exists($target->getUri(), $activity->context->attention)) {
|
||||
// @todo FIXME: Please document (i18n).
|
||||
// TRANS: Client exception when ...
|
||||
throw new ClientException(_('Object not posted to this user.'));
|
||||
}
|
||||
} else {
|
||||
// TRANS: Server exception thrown when a micro app plugin uses a target that cannot be handled.
|
||||
throw new ServerException(_('Do not know how to handle this kind of target.'));
|
||||
}
|
||||
|
||||
$oactor = Ostatus_profile::ensureActivityObjectProfile($activity->actor);
|
||||
$actor = $oactor->localProfile();
|
||||
|
||||
// FIXME: will this work in all cases? I made it work for Favorite...
|
||||
if (ActivityUtils::compareVerbs($activity->verb, array(ActivityVerb::POST))) {
|
||||
$object = $activity->objects[0];
|
||||
} else {
|
||||
$object = $activity;
|
||||
}
|
||||
|
||||
$options = array('uri' => $object->id,
|
||||
'url' => $object->link,
|
||||
'self' => $object->selfLink,
|
||||
'is_local' => Notice::REMOTE,
|
||||
'source' => 'ostatus');
|
||||
|
||||
$notice = $this->saveNoticeFromActivity($activity, $actor, $options);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle object posted via AtomPub
|
||||
*
|
||||
* @param Activity $activity Activity that was posted
|
||||
* @param Profile $scoped Profile of user posting
|
||||
* @param Notice &$notice Resulting notice
|
||||
*
|
||||
* @return boolean hook value
|
||||
*/
|
||||
public function onStartAtomPubNewActivity(Activity $activity, Profile $scoped, Notice &$notice=null)
|
||||
{
|
||||
if (!$this->isMyActivity($activity)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$options = array('source' => 'atompub');
|
||||
|
||||
$notice = $this->saveNoticeFromActivity($activity, $scoped, $options);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle object imported from a backup file
|
||||
*
|
||||
* @param User $user User to import for
|
||||
* @param ActivityObject $author Original author per import file
|
||||
* @param Activity $activity Activity to import
|
||||
* @param boolean $trusted Is this a trusted user?
|
||||
* @param boolean &$done Is this done (success or unrecoverable error)
|
||||
*
|
||||
* @return boolean hook value
|
||||
*/
|
||||
function onStartImportActivity($user, $author, Activity $activity, $trusted, &$done)
|
||||
{
|
||||
if (!$this->isMyActivity($activity)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$obj = $activity->objects[0];
|
||||
|
||||
$options = array('uri' => $object->id,
|
||||
'url' => $object->link,
|
||||
'self' => $object->selfLink,
|
||||
'source' => 'restore');
|
||||
|
||||
// $user->getProfile() is a Profile
|
||||
$saved = $this->saveNoticeFromActivity($activity,
|
||||
$user->getProfile(),
|
||||
$options);
|
||||
|
||||
if (!empty($saved)) {
|
||||
$done = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler gives the plugin a chance to add custom
|
||||
* Atom XML ActivityStreams output from a previously filled-out
|
||||
* ActivityObject.
|
||||
*
|
||||
* The atomOutput method is called if it's one of
|
||||
* our matching types.
|
||||
*
|
||||
* @param ActivityObject $obj
|
||||
* @param XMLOutputter $out to add elements at end of object
|
||||
* @return boolean hook return value
|
||||
*/
|
||||
function onEndActivityObjectOutputAtom(ActivityObject $obj, XMLOutputter $out)
|
||||
{
|
||||
if (in_array($obj->type, $this->types())) {
|
||||
$this->activityObjectOutputAtom($obj, $out);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler gives the plugin a chance to add custom
|
||||
* JSON ActivityStreams output from a previously filled-out
|
||||
* ActivityObject.
|
||||
*
|
||||
* The activityObjectOutputJson method is called if it's one of
|
||||
* our matching types.
|
||||
*
|
||||
* @param ActivityObject $obj
|
||||
* @param array &$out JSON-targeted array which can be modified
|
||||
* @return boolean hook return value
|
||||
*/
|
||||
function onEndActivityObjectOutputJson(ActivityObject $obj, array &$out)
|
||||
{
|
||||
if (in_array($obj->type, $this->types())) {
|
||||
$this->activityObjectOutputJson($obj, $out);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onStartOpenNoticeListItemElement(NoticeListItem $nli)
|
||||
{
|
||||
if (!$this->isMyNotice($nli->notice)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->openNoticeListItemElement($nli);
|
||||
|
||||
Event::handle('EndOpenNoticeListItemElement', array($nli));
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onStartCloseNoticeListItemElement(NoticeListItem $nli)
|
||||
{
|
||||
if (!$this->isMyNotice($nli->notice)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->closeNoticeListItemElement($nli);
|
||||
|
||||
Event::handle('EndCloseNoticeListItemElement', array($nli));
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function openNoticeListItemElement(NoticeListItem $nli)
|
||||
{
|
||||
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
|
||||
$class = 'h-entry notice ' . $this->tag();
|
||||
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
|
||||
$class .= ' limited-scope';
|
||||
}
|
||||
try {
|
||||
$class .= ' notice-source-'.common_to_alphanumeric($nli->notice->source);
|
||||
} catch (Exception $e) {
|
||||
// either source or what we filtered out was a zero-length string
|
||||
}
|
||||
$nli->out->elementStart('li', array('class' => $class,
|
||||
'id' => 'notice-' . $id));
|
||||
}
|
||||
|
||||
protected function closeNoticeListItemElement(NoticeListItem $nli)
|
||||
{
|
||||
$nli->out->elementEnd('li');
|
||||
}
|
||||
|
||||
|
||||
// FIXME: This is overriden in MicroAppPlugin but shouldn't have to be
|
||||
public function onStartShowNoticeItem(NoticeListItem $nli)
|
||||
{
|
||||
if (!$this->isMyNotice($nli->notice)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->showNoticeListItem($nli);
|
||||
} catch (Exception $e) {
|
||||
common_log(LOG_ERR, 'Error showing notice '.$nli->getNotice()->getID().': ' . $e->getMessage());
|
||||
$nli->out->element('p', 'error', sprintf(_('Error showing notice: %s'), $e->getMessage()));
|
||||
}
|
||||
|
||||
Event::handle('EndShowNoticeItem', array($nli));
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function showNoticeListItem(NoticeListItem $nli)
|
||||
{
|
||||
$nli->showNoticeHeaders();
|
||||
$nli->showContent();
|
||||
$nli->showNoticeFooter();
|
||||
}
|
||||
|
||||
public function onStartShowNoticeItemNotice(NoticeListItem $nli)
|
||||
{
|
||||
if (!$this->isMyNotice($nli->notice)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->showNoticeItemNotice($nli);
|
||||
|
||||
Event::handle('EndShowNoticeItemNotice', array($nli));
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function showNoticeItemNotice(NoticeListItem $nli)
|
||||
{
|
||||
$nli->showNoticeTitle();
|
||||
$nli->showAuthor();
|
||||
$nli->showAddressees();
|
||||
$nli->showContent();
|
||||
}
|
||||
|
||||
public function onStartShowNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped=null)
|
||||
{
|
||||
if (!$this->isMyNotice($stored)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->showNoticeContent($stored, $out, $scoped);
|
||||
} catch (Exception $e) {
|
||||
$out->element('div', 'error', $e->getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped=null)
|
||||
{
|
||||
$out->text($stored->getContent());
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
* @package Activity
|
||||
* @maintainer Mikael Nordfeldth <mmn@hethane.se>
|
||||
*/
|
||||
abstract class ActivityVerbHandlerModule extends ActivityHandlerPlugin
|
||||
abstract class ActivityVerbHandlerModule extends ActivityHandlerModule
|
||||
{
|
||||
public function onActivityVerbTitle(ManagedAction $action, $verb, Notice $target, Profile $scoped, &$title)
|
||||
{
|
||||
|
82
lib/modules/ActivityVerbHandlerPlugin.php
Normal file
82
lib/modules/ActivityVerbHandlerPlugin.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/*
|
||||
* GNU Social - a federating social network
|
||||
* Copyright (C) 2014, Free Software Foundation, 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('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
/**
|
||||
* @package Activity
|
||||
* @maintainer Mikael Nordfeldth <mmn@hethane.se>
|
||||
*/
|
||||
abstract class ActivityVerbHandlerPlugin extends ActivityHandlerPlugin
|
||||
{
|
||||
public function onActivityVerbTitle(ManagedAction $action, $verb, Notice $target, Profile $scoped, &$title)
|
||||
{
|
||||
if (!$this->isMyVerb($verb)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$title = $this->getActionTitle($action, $verb, $target, $scoped);
|
||||
return false;
|
||||
}
|
||||
abstract protected function getActionTitle(ManagedAction $action, $verb, Notice $target, Profile $scoped);
|
||||
|
||||
public function onActivityVerbShowContent(ManagedAction $action, $verb, Notice $target, Profile $scoped)
|
||||
{
|
||||
if (!$this->isMyVerb($verb)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->showActionContent($action, $verb, $target, $scoped);
|
||||
}
|
||||
protected function showActionContent(ManagedAction $action, $verb, Notice $target, Profile $scoped)
|
||||
{
|
||||
if (!GNUsocial::isAjax()) {
|
||||
$nl = new NoticeListItem($target, $action, array('options'=>false, 'attachments'=>false,
|
||||
'item_tag'=>'div', 'id_prefix'=>'fave'));
|
||||
$nl->show();
|
||||
}
|
||||
|
||||
$form = $this->getActivityForm($action, $verb, $target, $scoped);
|
||||
$form->show();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivityVerbDoPreparation(ManagedAction $action, $verb, Notice $target, Profile $scoped)
|
||||
{
|
||||
if (!$this->isMyVerb($verb)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->doActionPreparation($action, $verb, $target, $scoped);
|
||||
}
|
||||
abstract protected function doActionPreparation(ManagedAction $action, $verb, Notice $target, Profile $scoped);
|
||||
|
||||
public function onActivityVerbDoPost(ManagedAction $action, $verb, Notice $target, Profile $scoped)
|
||||
{
|
||||
if (!$this->isMyVerb($verb)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->doActionPost($action, $verb, $target, $scoped);
|
||||
}
|
||||
abstract protected function doActionPost(ManagedAction $action, $verb, Notice $target, Profile $scoped);
|
||||
|
||||
abstract protected function getActivityForm(ManagedAction $action, $verb, Notice $target, Profile $scoped);
|
||||
}
|
260
lib/modules/AuthenticationModule.php
Normal file
260
lib/modules/AuthenticationModule.php
Normal file
@ -0,0 +1,260 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Superclass for plugins that do authentication and/or authorization
|
||||
*
|
||||
* 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 Plugin
|
||||
* @package StatusNet
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @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('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
/**
|
||||
* Superclass for plugins that do authentication
|
||||
*
|
||||
* @category Module
|
||||
* @package GNUsocial
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @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 AuthenticationModule extends Module
|
||||
{
|
||||
//is this plugin authoritative for authentication?
|
||||
public $authoritative = false;
|
||||
|
||||
//should accounts be automatically created after a successful login attempt?
|
||||
public $autoregistration = false;
|
||||
|
||||
//can the user change their email address
|
||||
public $password_changeable=true;
|
||||
|
||||
//unique name for this authentication provider
|
||||
public $provider_name;
|
||||
|
||||
//------------Auth plugin should implement some (or all) of these methods------------\\
|
||||
/**
|
||||
* Check if a nickname/password combination is valid
|
||||
* @param username
|
||||
* @param password
|
||||
* @return boolean true if the credentials are valid, false if they are invalid.
|
||||
*/
|
||||
function checkPassword($username, $password)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically register a user when they attempt to login with valid credentials.
|
||||
* User::register($data) is a very useful method for this implementation
|
||||
* @param username username (that is used to login and find the user in the authentication provider) of the user to be registered
|
||||
* @param nickname nickname of the user in the SN system. If nickname is null, then set nickname = username
|
||||
* @return mixed instance of User, or false (if user couldn't be created)
|
||||
*/
|
||||
function autoRegister($username, $nickname = null)
|
||||
{
|
||||
if(is_null($nickname)){
|
||||
$nickname = $username;
|
||||
}
|
||||
$registration_data = array();
|
||||
$registration_data['nickname'] = $nickname;
|
||||
return User::register($registration_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change a user's password
|
||||
* The old password has been verified to be valid by this plugin before this call is made
|
||||
* @param username
|
||||
* @param oldpassword
|
||||
* @param newpassword
|
||||
* @return boolean true if the password was changed, false if password changing failed for some reason
|
||||
*/
|
||||
function changePassword($username,$oldpassword,$newpassword)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a username, suggest what the nickname should be
|
||||
* Used during autoregistration
|
||||
* Useful if your usernames are ugly, and you want to suggest
|
||||
* nice looking nicknames when users initially sign on
|
||||
* All nicknames returned by this function should be valid
|
||||
* implementations may want to use common_nicknamize() to ensure validity
|
||||
* @param username
|
||||
* @return string nickname
|
||||
*/
|
||||
function suggestNicknameForUsername($username)
|
||||
{
|
||||
return common_nicknamize($username);
|
||||
}
|
||||
|
||||
//------------Below are the methods that connect StatusNet to the implementing Auth plugin------------\\
|
||||
function onInitializePlugin(){
|
||||
if(!isset($this->provider_name)){
|
||||
throw new Exception("must specify a provider_name for this authentication provider");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal AutoRegister event handler
|
||||
* @param nickname
|
||||
* @param provider_name
|
||||
* @param user - the newly registered user
|
||||
*/
|
||||
function onAutoRegister($nickname, $provider_name, &$user)
|
||||
{
|
||||
if($provider_name == $this->provider_name && $this->autoregistration){
|
||||
$suggested_nickname = $this->suggestNicknameForUsername($nickname);
|
||||
$test_user = User::getKV('nickname', $suggested_nickname);
|
||||
if($test_user) {
|
||||
//someone already exists with the suggested nickname, so used the passed nickname
|
||||
$suggested_nickname = common_nicknamize($nickname);
|
||||
}
|
||||
$test_user = User::getKV('nickname', $suggested_nickname);
|
||||
if($test_user) {
|
||||
//someone already exists with the suggested nickname
|
||||
//not much else we can do
|
||||
}else{
|
||||
$user = $this->autoRegister($nickname, $suggested_nickname);
|
||||
if ($user instanceof User) {
|
||||
User_username::register($user,$nickname,$this->provider_name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onStartCheckPassword($nickname, $password, &$authenticatedUser){
|
||||
//map the nickname to a username
|
||||
$user_username = new User_username();
|
||||
$user_username->username=$nickname;
|
||||
$user_username->provider_name=$this->provider_name;
|
||||
if($user_username->find() && $user_username->fetch()){
|
||||
$authenticated = $this->checkPassword($user_username->username, $password);
|
||||
if($authenticated){
|
||||
$authenticatedUser = User::getKV('id', $user_username->user_id);
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
//$nickname is the username used to login
|
||||
//$suggested_nickname is the nickname the auth provider suggests for that username
|
||||
$suggested_nickname = $this->suggestNicknameForUsername($nickname);
|
||||
$user = User::getKV('nickname', $suggested_nickname);
|
||||
if($user){
|
||||
//make sure this user isn't claimed
|
||||
$user_username = new User_username();
|
||||
$user_username->user_id=$user->id;
|
||||
$we_can_handle = false;
|
||||
if($user_username->find()){
|
||||
//either this provider, or another one, has already claimed this user
|
||||
//so we cannot. Let another plugin try.
|
||||
return;
|
||||
}else{
|
||||
//no other provider claims this user, so it's safe for us to handle it
|
||||
$authenticated = $this->checkPassword($nickname, $password);
|
||||
if($authenticated){
|
||||
$authenticatedUser = $user;
|
||||
User_username::register($authenticatedUser,$nickname,$this->provider_name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$authenticated = $this->checkPassword($nickname, $password);
|
||||
if($authenticated){
|
||||
if(! Event::handle('AutoRegister', array($nickname, $this->provider_name, &$authenticatedUser))){
|
||||
//unlike most Event::handle lines of code, this one has a ! (not)
|
||||
//we want to do this if the event *was* handled - this isn't a "default" implementation
|
||||
//like most code of this form.
|
||||
if($authenticatedUser){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($this->authoritative){
|
||||
return false;
|
||||
}else{
|
||||
//we're not authoritative, so let other handlers try
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function onStartChangePassword(Profile $target ,$oldpassword, $newpassword)
|
||||
{
|
||||
if($this->password_changeable){
|
||||
$user_username = new User_username();
|
||||
$user_username->user_id = $target->getID();
|
||||
$user_username->provider_name=$this->provider_name;
|
||||
if ($user_username->find(true)) {
|
||||
$authenticated = $this->checkPassword($user_username->username, $oldpassword);
|
||||
if($authenticated){
|
||||
$result = $this->changePassword($user_username->username,$oldpassword,$newpassword);
|
||||
if($result){
|
||||
//stop handling of other handlers, because what was requested was done
|
||||
return false;
|
||||
}else{
|
||||
// TRANS: Exception thrown when a password change fails.
|
||||
throw new Exception(_('Password changing failed.'));
|
||||
}
|
||||
}else{
|
||||
if($this->authoritative){
|
||||
//since we're authoritative, no other plugin could do this
|
||||
// TRANS: Exception thrown when a password change fails.
|
||||
throw new Exception(_('Password changing failed.'));
|
||||
}else{
|
||||
//let another handler try
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if($this->authoritative){
|
||||
//since we're authoritative, no other plugin could do this
|
||||
// TRANS: Exception thrown when a password change attempt fails because it is not allowed.
|
||||
throw new Exception(_('Password changing is not allowed.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onStartAccountSettingsPasswordMenuItem($widget)
|
||||
{
|
||||
if($this->authoritative && !$this->password_changeable){
|
||||
//since we're authoritative, no other plugin could change passwords, so do not render the menu item
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function onCheckSchema() {
|
||||
$schema = Schema::get();
|
||||
$schema->ensureTable('user_username', User_username::schemaDef());
|
||||
return true;
|
||||
}
|
||||
|
||||
function onUserDeleteRelated($user, &$tables)
|
||||
{
|
||||
$tables[] = 'User_username';
|
||||
return true;
|
||||
}
|
||||
}
|
@ -48,7 +48,7 @@ if (!defined('STATUSNET')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
abstract class MicroAppModule extends ActivityHandlerPlugin
|
||||
abstract class MicroAppPlugin extends ActivityHandlerPlugin
|
||||
{
|
||||
/**
|
||||
* Returns a localized string which represents this micro-app,
|
221
lib/modules/Module.php
Normal file
221
lib/modules/Module.php
Normal file
@ -0,0 +1,221 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social 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.
|
||||
//
|
||||
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Base class for modules
|
||||
*
|
||||
* A base class for GNU social modules. Mostly a light wrapper around
|
||||
* the Event framework.
|
||||
*
|
||||
* Subclasses of Module will automatically handle an event if they define
|
||||
* a method called "onEventName". (Well, OK -- only if they call parent::__construct()
|
||||
* in their constructors.)
|
||||
*
|
||||
* They will also automatically handle the InitializeModule and CleanupModule with the
|
||||
* initialize() and cleanup() methods, respectively.
|
||||
*
|
||||
* @category Module
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010-2019 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*
|
||||
* @see Event
|
||||
*/
|
||||
class Module
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
Event::addHandler('InitializeModule', [$this, 'initialize']);
|
||||
Event::addHandler('CleanupModule', [$this, 'cleanup']);
|
||||
|
||||
foreach (get_class_methods($this) as $method) {
|
||||
if (mb_substr($method, 0, 2) == 'on') {
|
||||
Event::addHandler(mb_substr($method, 2), [$this, $method]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->setupGettext();
|
||||
}
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function cleanup()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load related components when needed
|
||||
*
|
||||
* Most non-trivial plugins will require extra components to do their work. Typically
|
||||
* these include data classes, action classes, widget classes, or external libraries.
|
||||
*
|
||||
* This method receives a class name and loads the PHP file related to that class. By
|
||||
* tradition, action classes typically have files named for the action, all lower-case.
|
||||
* Data classes are in files with the data class name, initial letter capitalized.
|
||||
*
|
||||
* Note that this method will be called for *all* overloaded classes, not just ones
|
||||
* in this plugin! So, make sure to return true by default to let other plugins, and
|
||||
* the core code, get a chance.
|
||||
*
|
||||
* @param string $cls Name of the class to be loaded
|
||||
*
|
||||
* @return bool hook value; true means continue processing, false means stop.
|
||||
*/
|
||||
public function onAutoload($cls)
|
||||
{
|
||||
$cls = basename($cls);
|
||||
$basedir = INSTALLDIR . '/modules/' . mb_substr(get_called_class(), 0, -6);
|
||||
|
||||
$file = null;
|
||||
|
||||
if (preg_match('/^(\w+)(Action|Form)$/', $cls, $type)) {
|
||||
$type = array_map('strtolower', $type);
|
||||
$file = "{$basedir}/{$type[2]}s/{$type[1]}.php";
|
||||
}
|
||||
if (!file_exists($file)) {
|
||||
$file = "{$basedir}/classes/{$cls}.php";
|
||||
|
||||
// library files can be put into subdirs ('_'->'/' conversion)
|
||||
// such as LRDDMethod_WebFinger -> lib/lrddmethod/webfinger.php
|
||||
if (!file_exists($file)) {
|
||||
$type = strtolower($cls);
|
||||
$type = str_replace('_', '/', $type);
|
||||
$file = "{$basedir}/lib/{$type}.php";
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($file) && file_exists($file)) {
|
||||
require_once $file;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this plugin has localization that needs to be set up.
|
||||
* Gettext localizations can be called via the _m() helper function.
|
||||
*/
|
||||
protected function setupGettext()
|
||||
{
|
||||
$class = get_class($this);
|
||||
if (substr($class, -6) == 'Module') {
|
||||
$name = substr($class, 0, -6);
|
||||
$path = common_config('plugins', 'locale_path');
|
||||
if (!$path) {
|
||||
// @fixme this will fail for things installed in local/plugins
|
||||
// ... but then so will web links so far.
|
||||
$path = INSTALLDIR . "/modules/{$name}/locale";
|
||||
}
|
||||
if (file_exists($path) && is_dir($path)) {
|
||||
bindtextdomain($name, $path);
|
||||
bind_textdomain_codeset($name, 'UTF-8');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function log($level, $msg)
|
||||
{
|
||||
common_log($level, get_class($this) . ': ' . $msg);
|
||||
}
|
||||
|
||||
protected function debug($msg)
|
||||
{
|
||||
$this->log(LOG_DEBUG, $msg);
|
||||
}
|
||||
|
||||
public function name()
|
||||
{
|
||||
$cls = get_class($this);
|
||||
return mb_substr($cls, 0, -6);
|
||||
}
|
||||
|
||||
public function version()
|
||||
{
|
||||
return GNUSOCIAL_VERSION;
|
||||
}
|
||||
|
||||
protected function userAgent()
|
||||
{
|
||||
return HTTPClient::userAgent()
|
||||
. ' (' . get_class($this) . ' v' . $this->version() . ')';
|
||||
}
|
||||
|
||||
public function onModuleVersion(array &$versions): bool
|
||||
{
|
||||
$name = $this->name();
|
||||
|
||||
$versions[] = [
|
||||
'name' => $name,
|
||||
// TRANS: Displayed as version information for a plugin if no version information was found.
|
||||
'version' => _m('Unknown')
|
||||
];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function staticPath($module, $relative)
|
||||
{
|
||||
if (GNUsocial::useHTTPS()) {
|
||||
$server = common_config('plugins', 'sslserver');
|
||||
} else {
|
||||
$server = common_config('plugins', 'server');
|
||||
}
|
||||
|
||||
if (empty($server)) {
|
||||
if (GNUsocial::useHTTPS()) {
|
||||
$server = common_config('site', 'sslserver');
|
||||
}
|
||||
if (empty($server)) {
|
||||
$server = common_config('site', 'server');
|
||||
}
|
||||
}
|
||||
|
||||
if (GNUsocial::useHTTPS()) {
|
||||
$path = common_config('plugins', 'sslpath');
|
||||
} else {
|
||||
$path = common_config('plugins', 'path');
|
||||
}
|
||||
|
||||
if (empty($path)) {
|
||||
$path = common_config('site', 'path') . '/modules/';
|
||||
}
|
||||
|
||||
if ($path[strlen($path) - 1] != '/') {
|
||||
$path .= '/';
|
||||
}
|
||||
|
||||
if ($path[0] != '/') {
|
||||
$path = '/' . $path;
|
||||
}
|
||||
|
||||
$protocol = GNUsocial::useHTTPS() ? 'https' : 'http';
|
||||
|
||||
return $protocol . '://' . $server . $path . $module . '/' . $relative;
|
||||
}
|
||||
|
||||
public function path($relative)
|
||||
{
|
||||
return self::staticPath($this->name(), $relative);
|
||||
}
|
||||
}
|
@ -17,9 +17,9 @@
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Base class for modules
|
||||
* Base class for plugins
|
||||
*
|
||||
* A base class for GNU social modules. Mostly a light wrapper around
|
||||
* A base class for GNU social plugin. Mostly a light wrapper around
|
||||
* the Event framework.
|
||||
*
|
||||
* Subclasses of Plugin will automatically handle an event if they define
|
||||
@ -37,7 +37,7 @@ defined('GNUSOCIAL') || die();
|
||||
*
|
||||
* @see Event
|
||||
*/
|
||||
class Plugin
|
||||
class Plugin extends Module
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@ -46,7 +46,7 @@ class Plugin
|
||||
|
||||
foreach (get_class_methods($this) as $method) {
|
||||
if (mb_substr($method, 0, 2) == 'on') {
|
||||
Event::addHandler(mb_substr($method, 2), array($this, $method));
|
||||
Event::addHandler(mb_substr($method, 2), [$this, $method]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,9 +85,6 @@ class Plugin
|
||||
{
|
||||
$cls = basename($cls);
|
||||
$basedir = INSTALLDIR . '/local/plugins/' . mb_substr(get_called_class(), 0, -6);
|
||||
if (!file_exists($basedir)) {
|
||||
$basedir = INSTALLDIR . '/modules/' . mb_substr(get_called_class(), 0, -6);
|
||||
}
|
||||
if (!file_exists($basedir)) {
|
||||
$basedir = INSTALLDIR . '/plugins/' . mb_substr(get_called_class(), 0, -6);
|
||||
}
|
||||
@ -111,7 +108,7 @@ class Plugin
|
||||
}
|
||||
|
||||
if (!is_null($file) && file_exists($file)) {
|
||||
require_once($file);
|
||||
require_once $file;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -125,16 +122,13 @@ class Plugin
|
||||
protected function setupGettext()
|
||||
{
|
||||
$class = get_class($this);
|
||||
if (substr($class, -6) == 'Module') {
|
||||
if (substr($class, -6) == 'Plugin') {
|
||||
$name = substr($class, 0, -6);
|
||||
$path = common_config('plugins', 'locale_path');
|
||||
if (!$path) {
|
||||
// @fixme this will fail for things installed in local/plugins
|
||||
// ... but then so will web links so far.
|
||||
$path = INSTALLDIR . "/plugins/{$name}/locale";
|
||||
if (!file_exists($path)) {
|
||||
$path = INSTALLDIR . "/modules/{$name}/locale";
|
||||
}
|
||||
if (!file_exists($path)) {
|
||||
$path = INSTALLDIR . "/local/plugins/{$name}/locale";
|
||||
}
|
||||
@ -146,50 +140,25 @@ class Plugin
|
||||
}
|
||||
}
|
||||
|
||||
protected function log($level, $msg)
|
||||
{
|
||||
common_log($level, get_class($this) . ': ' . $msg);
|
||||
}
|
||||
|
||||
protected function debug($msg)
|
||||
{
|
||||
$this->log(LOG_DEBUG, $msg);
|
||||
}
|
||||
|
||||
public function name()
|
||||
{
|
||||
$cls = get_class($this);
|
||||
return mb_substr($cls, 0, -6);
|
||||
}
|
||||
|
||||
public function version()
|
||||
{
|
||||
return GNUSOCIAL_VERSION;
|
||||
}
|
||||
|
||||
protected function userAgent()
|
||||
{
|
||||
return HTTPClient::userAgent()
|
||||
. ' (' . get_class($this) . ' v' . $this->version() . ')';
|
||||
}
|
||||
|
||||
public function onModuleVersion(array &$versions)
|
||||
public function onPluginVersion(array &$versions): bool
|
||||
{
|
||||
$name = $this->name();
|
||||
|
||||
$versions[] = array('name' => $name,
|
||||
$versions[] = [
|
||||
'name' => $name,
|
||||
// TRANS: Displayed as version information for a plugin if no version information was found.
|
||||
'version' => _('Unknown'));
|
||||
'version' => _m('Unknown')
|
||||
];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function path($relative)
|
||||
public function onModuleVersion(array &$versions): bool
|
||||
{
|
||||
return self::staticPath($this->name(), $relative);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function staticPath($module, $relative)
|
||||
public static function staticPath($plugin, $relative)
|
||||
{
|
||||
if (GNUsocial::useHTTPS()) {
|
||||
$server = common_config('plugins', 'sslserver');
|
||||
@ -214,10 +183,8 @@ class Plugin
|
||||
|
||||
if (empty($path)) {
|
||||
// XXX: extra stat().
|
||||
if (@file_exists(PUBLICDIR . '/local/plugins/' . $module . '/' . $relative)) {
|
||||
if (@file_exists(PUBLICDIR . '/local/plugins/' . $plugin . '/' . $relative)) {
|
||||
$path = common_config('site', 'path') . '/local/plugins/';
|
||||
} elseif (@file_exists(PUBLICDIR . '/modules/' . $module . '/' . $relative)) {
|
||||
$path = common_config('site', 'path') . '/modules/';
|
||||
} else {
|
||||
$path = common_config('site', 'path') . '/plugins/';
|
||||
}
|
||||
@ -233,6 +200,11 @@ class Plugin
|
||||
|
||||
$protocol = GNUsocial::useHTTPS() ? 'https' : 'http';
|
||||
|
||||
return $protocol . '://' . $server . $path . $module . '/' . $relative;
|
||||
return $protocol . '://' . $server . $path . $plugin . '/' . $relative;
|
||||
}
|
||||
|
||||
public function path($relative)
|
||||
{
|
||||
return self::staticPath($this->name(), $relative);
|
||||
}
|
||||
}
|
||||
|
@ -17,16 +17,16 @@
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Queue handler for letting modules handle stuff.
|
||||
* Queue handler for letting plugins handle stuff.
|
||||
*
|
||||
* The module queue handler accepts notices over the "module" queue
|
||||
* The module queue handler accepts notices over the "plugin" queue
|
||||
* and simply passes them through the "HandleQueuedNotice" event.
|
||||
*
|
||||
* This gives plugins a chance to do background processing without
|
||||
* actually registering their own queue and ensuring that things
|
||||
* are queued into it.
|
||||
*
|
||||
* Fancier modules may wish to instead hook the 'GetQueueHandlerClass'
|
||||
* Fancier plugins may wish to instead hook the 'GetQueueHandlerClass'
|
||||
* event with their own class, in which case they must ensure that
|
||||
* their notices get enqueued when they need them.
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ if (!defined('STATUSNET')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ActivityPlugin extends Plugin
|
||||
class ActivityModule extends Module
|
||||
{
|
||||
const PLUGIN_VERSION = '0.1.0';
|
||||
const SOURCE = 'activity';
|
||||
@ -88,7 +88,7 @@ class ActivityPlugin extends Plugin
|
||||
|
||||
$notice = Notice::saveNew($profile->id,
|
||||
$content,
|
||||
ActivityPlugin::SOURCE,
|
||||
ActivityModule::SOURCE,
|
||||
array('rendered' => $rendered,
|
||||
'urls' => array(),
|
||||
'replies' => array($other->getUri()),
|
||||
@ -131,7 +131,7 @@ class ActivityPlugin extends Plugin
|
||||
|
||||
$notice = Notice::saveNew($profile->id,
|
||||
$content,
|
||||
ActivityPlugin::SOURCE,
|
||||
ActivityModule::SOURCE,
|
||||
array('rendered' => $rendered,
|
||||
'urls' => array(),
|
||||
'replies' => array($other->getUri()),
|
||||
@ -176,7 +176,7 @@ class ActivityPlugin extends Plugin
|
||||
|
||||
$notice = Notice::saveNew($profile->id,
|
||||
$content,
|
||||
ActivityPlugin::SOURCE,
|
||||
ActivityModule::SOURCE,
|
||||
array('rendered' => $rendered,
|
||||
'urls' => array(),
|
||||
'replies' => array($author->getUri()),
|
||||
@ -219,7 +219,7 @@ class ActivityPlugin extends Plugin
|
||||
|
||||
$notice = Notice::saveNew($profile->id,
|
||||
$content,
|
||||
ActivityPlugin::SOURCE,
|
||||
ActivityModule::SOURCE,
|
||||
array('rendered' => $rendered,
|
||||
'urls' => array(),
|
||||
'groups' => array($group->id),
|
||||
@ -262,7 +262,7 @@ class ActivityPlugin extends Plugin
|
||||
|
||||
$notice = Notice::saveNew($profile->id,
|
||||
$content,
|
||||
ActivityPlugin::SOURCE,
|
||||
ActivityModule::SOURCE,
|
||||
array('rendered' => $rendered,
|
||||
'urls' => array(),
|
||||
'groups' => array($group->id),
|
||||
@ -339,14 +339,14 @@ class ActivityPlugin extends Plugin
|
||||
return true;
|
||||
}
|
||||
|
||||
function onPluginVersion(array &$versions)
|
||||
function onModuleVersion(array &$versions): bool
|
||||
{
|
||||
$versions[] = array('name' => 'Activity',
|
||||
'version' => self::PLUGIN_VERSION,
|
||||
'author' => 'Evan Prodromou',
|
||||
'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/Activity',
|
||||
'rawdescription' =>
|
||||
// TRANS: Plugin description.
|
||||
// TRANS: Module description.
|
||||
_m('Emits notices when social activities happen.'));
|
||||
return true;
|
||||
}
|
214
modules/ActivityModeration/ActivityModerationModule.php
Normal file
214
modules/ActivityModeration/ActivityModerationModule.php
Normal file
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Activity
|
||||
* @maintainer Mikael Nordfeldth <mmn@hethane.se>
|
||||
*/
|
||||
class ActivityModerationModule extends ActivityVerbHandlerModule
|
||||
{
|
||||
public function tag()
|
||||
{
|
||||
return 'actmod';
|
||||
}
|
||||
|
||||
public function types()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function verbs()
|
||||
{
|
||||
return array(ActivityVerb::DELETE);
|
||||
}
|
||||
|
||||
public function onBeforePluginCheckSchema()
|
||||
{
|
||||
Deleted_notice::beforeSchemaUpdate();
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onCheckSchema()
|
||||
{
|
||||
$schema = Schema::get();
|
||||
$schema->ensureTable('deleted_notice', Deleted_notice::schemaDef());
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onGetNoticeSqlTimestamp($id, &$timestamp)
|
||||
{
|
||||
try {
|
||||
$deleted = Deleted_notice::getByID($id);
|
||||
$timestamp = $deleted->act_created;
|
||||
} catch (NoResultException $e) {
|
||||
return true;
|
||||
}
|
||||
// we're done for the event, so return false to stop it
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onIsNoticeDeleted($id, &$deleted)
|
||||
{
|
||||
try {
|
||||
$found = Deleted_notice::getByID($id);
|
||||
$deleted = ($found instanceof Deleted_notice);
|
||||
} catch (NoResultException $e) {
|
||||
$deleted = false;
|
||||
}
|
||||
// return true (continue event) if $deleted is false, return false (stop event) if deleted notice was found
|
||||
return !$deleted;
|
||||
}
|
||||
|
||||
protected function getActionTitle(ManagedAction $action, $verb, Notice $target, Profile $scoped)
|
||||
{
|
||||
// FIXME: switch based on action type
|
||||
return _m('TITLE', 'Notice moderation');
|
||||
}
|
||||
|
||||
protected function doActionPreparation(ManagedAction $action, $verb, Notice $target, Profile $scoped)
|
||||
{
|
||||
// pass
|
||||
}
|
||||
|
||||
protected function doActionPost(ManagedAction $action, $verb, Notice $target, Profile $scoped)
|
||||
{
|
||||
switch (true) {
|
||||
case ActivityUtils::compareVerbs($verb, array(ActivityVerb::DELETE)):
|
||||
// do whatever preparation is necessary to delete a verb
|
||||
$target->deleteAs($scoped);
|
||||
break;
|
||||
default:
|
||||
throw new ServerException('ActivityVerb POST not handled by plugin that was supposed to do it.');
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteRelated(Notice $notice)
|
||||
{
|
||||
// pass
|
||||
}
|
||||
|
||||
public function onDeleteNoticeAsProfile(Notice $stored, Profile $actor, &$result) {
|
||||
// By adding a new object with the 'delete' verb we will trigger
|
||||
// $this->saveObjectFromActivity that will do the actual ->delete()
|
||||
if (false === Deleted_notice::addNew($stored, $actor)) {
|
||||
// false is returned if we did not have an error, but did not create the object
|
||||
// (i.e. the author is currently being deleted)
|
||||
return true;
|
||||
}
|
||||
|
||||
// We return false (to stop the event) if the deleted_notice entry was
|
||||
// added, which means we have already run $this->saveObjectFromActivity
|
||||
// which in turn has called the delete function of the notice.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is run when a 'delete' verb activity comes in.
|
||||
*
|
||||
* @return boolean hook flag
|
||||
*/
|
||||
protected function saveObjectFromActivity(Activity $act, Notice $stored, array $options=array())
|
||||
{
|
||||
// Everything is done in the StartNoticeSave event
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME: Put this in lib/modules/ActivityHandlerPlugin.php when we're ready
|
||||
// with the other microapps/activityhandlers as well.
|
||||
// Also it should be StartNoticeAsActivity (with a prepped Activity, including ->context etc.)
|
||||
public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)
|
||||
{
|
||||
if (!$this->isMyNotice($stored)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
common_debug('Extending activity '.$stored->id.' with '.get_called_class());
|
||||
$this->extendActivity($stored, $act, $scoped);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is run before ->insert, so our task in this function is just to
|
||||
* delete if it is the delete verb.
|
||||
*/
|
||||
public function onStartNoticeSave(Notice $stored)
|
||||
{
|
||||
// DELETE is a bit special, we have to remove the existing entry and then
|
||||
// add a new one with the same URI in order to trigger the distribution.
|
||||
// (that's why we don't use $this->isMyNotice(...))
|
||||
if (!ActivityUtils::compareVerbs($stored->verb, array(ActivityVerb::DELETE))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
$target = Notice::getByUri($stored->uri);
|
||||
} catch (NoResultException $e) {
|
||||
throw new AlreadyFulfilledException('Notice URI not found, so we have nothing to delete.');
|
||||
}
|
||||
|
||||
$actor = $stored->getProfile();
|
||||
$owner = $target->getProfile();
|
||||
|
||||
if ($owner->hasRole(Profile_role::DELETED)) {
|
||||
// Don't bother with replacing notices if its author is being deleted.
|
||||
// The later "StoreActivityObject" will pick this up and execute
|
||||
// the deletion then.
|
||||
// (the "delete verb notice" is too new to ever pass through Notice::saveNew
|
||||
// which otherwise wouldn't execute the StoreActivityObject event)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Since the user deleting may not be the same as the notice's owner,
|
||||
// double-check this and also set the "re-stored" notice profile_id.
|
||||
if (!$actor->sameAs($owner) && !$actor->hasRight(Right::DELETEOTHERSNOTICE)) {
|
||||
throw new AuthorizationException(_('You are not allowed to delete another user\'s notice.'));
|
||||
}
|
||||
|
||||
// We copy the identifying fields and replace the sensitive ones.
|
||||
//$stored->id = $target->id; // We can't copy this since DB_DataObject won't inject it anyway
|
||||
$props = array('uri', 'profile_id', 'conversation', 'reply_to', 'created', 'repeat_of', 'object_type', 'is_local', 'scope');
|
||||
foreach($props as $prop) {
|
||||
$stored->$prop = $target->$prop;
|
||||
}
|
||||
|
||||
// Let's see if this has been deleted already.
|
||||
try {
|
||||
$deleted = Deleted_notice::getByKeys( ['uri' => $stored->getUri()] );
|
||||
return $deleted;
|
||||
} catch (NoResultException $e) {
|
||||
$deleted = new Deleted_notice();
|
||||
|
||||
$deleted->id = $target->getID();
|
||||
$deleted->profile_id = $actor->getID();
|
||||
$deleted->uri = $stored->getUri();
|
||||
$deleted->act_created = $stored->created;
|
||||
$deleted->created = common_sql_now();
|
||||
|
||||
// throws exception on error
|
||||
$result = $deleted->insert();
|
||||
}
|
||||
|
||||
// Now we delete the original notice, leaving the id and uri free.
|
||||
$target->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function extendActivity(Notice $stored, Activity $act, Profile $scoped=null)
|
||||
{
|
||||
Deleted_notice::extendActivity($stored, $act, $scoped);
|
||||
}
|
||||
|
||||
public function activityObjectFromNotice(Notice $notice)
|
||||
{
|
||||
$object = Deleted_notice::fromStored($notice);
|
||||
return $object->asActivityObject();
|
||||
}
|
||||
|
||||
protected function getActivityForm(ManagedAction $action, $verb, Notice $target, Profile $scoped)
|
||||
{
|
||||
if (!$scoped instanceof Profile || !($scoped->sameAs($target->getProfile()) || $scoped->hasRight(Right::DELETEOTHERSNOTICE))) {
|
||||
throw new AuthorizationException(_('You are not allowed to delete other user\'s notices'));
|
||||
}
|
||||
return DeletenoticeForm($action, array('notice'=>$target));
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ msgctxt "BUTTON"
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#: ActivityModerationPlugin.php:64
|
||||
#: ActivityModerationModule.php:64
|
||||
msgctxt "TITLE"
|
||||
msgid "Notice moderation"
|
||||
msgstr ""
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* GNU social - a federating social network
|
||||
*
|
||||
* Plugin that handles activity verb interact (like 'favorite' etc.)
|
||||
* Module that handles activity verb interact (like 'favorite' etc.)
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
@ -19,7 +19,7 @@
|
||||
* 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 Plugin
|
||||
* @category Module
|
||||
* @package GNUsocial
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @copyright 2014 Free Software Foundation http://fsf.org
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
class ActivityVerbPlugin extends Plugin
|
||||
class ActivityVerbModule extends Module
|
||||
{
|
||||
const PLUGIN_VERSION = '2.0.0';
|
||||
|
||||
@ -57,14 +57,14 @@ class ActivityVerbPlugin extends Plugin
|
||||
'verb' => $verb_regexp]);
|
||||
}
|
||||
|
||||
public function onPluginVersion(array &$versions)
|
||||
public function onModuleVersion(array &$versions): bool
|
||||
{
|
||||
$versions[] = array('name' => 'Activity Verb',
|
||||
'version' => self::PLUGIN_VERSION,
|
||||
'author' => 'Mikael Nordfeldth',
|
||||
'homepage' => 'https://www.gnu.org/software/social/',
|
||||
'rawdescription' =>
|
||||
// TRANS: Plugin description.
|
||||
// TRANS: Module description.
|
||||
_m('Adds more standardized verb handling for activities.'));
|
||||
return true;
|
||||
}
|
@ -19,7 +19,7 @@
|
||||
* 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 Plugin
|
||||
* @category Module
|
||||
* @package GNUsocial
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @copyright 2015 Free Software Foundaction, Inc.
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: ActivityVerbPlugin.php:56
|
||||
#. TRANS: Module description.
|
||||
#: ActivityVerbModule.php:56
|
||||
msgid "Adds more standardized verb handling for activities."
|
||||
msgstr ""
|
||||
|
@ -23,9 +23,9 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
* @package Activity
|
||||
* @maintainer Mikael Nordfeldth <mmn@hethane.se>
|
||||
*/
|
||||
class ActivityVerbPostPlugin extends ActivityVerbHandlerPlugin
|
||||
class ActivityVerbPostModule extends ActivityVerbHandlerModule
|
||||
{
|
||||
const PLUGIN_VERSION = '2.0.0';
|
||||
const MODULE_VERSION = '2.0.0';
|
||||
|
||||
// TODO: Implement a "fallback" feature which can handle anything _as_ an activityobject "note"
|
||||
|
||||
@ -50,7 +50,7 @@ class ActivityVerbPostPlugin extends ActivityVerbHandlerPlugin
|
||||
return array(ActivityVerb::POST);
|
||||
}
|
||||
|
||||
// FIXME: Set this to abstract public in lib/ActivityHandlerPlugin.php when all plugins have migrated!
|
||||
// FIXME: Set this to abstract public in classes/modules/ActivityHandlerModule.php when all plugins have migrated!
|
||||
protected function saveObjectFromActivity(Activity $act, Notice $stored, array $options=array())
|
||||
{
|
||||
assert($this->isMyActivity($act));
|
||||
@ -127,14 +127,14 @@ class ActivityVerbPostPlugin extends ActivityVerbHandlerPlugin
|
||||
return new NoticeForm($action, array());
|
||||
}
|
||||
|
||||
public function onPluginVersion(array &$versions)
|
||||
public function onModuleVersion(array &$versions): bool
|
||||
{
|
||||
$versions[] = array('name' => 'Post verb',
|
||||
'version' => self::PLUGIN_VERSION,
|
||||
'version' => self::MODULE_VERSION,
|
||||
'author' => 'Mikael Nordfeldth',
|
||||
'homepage' => 'https://gnu.io/',
|
||||
'rawdescription' =>
|
||||
// TRANS: Plugin description.
|
||||
// TRANS: Module description.
|
||||
_m('Post handling with ActivityStreams.'));
|
||||
|
||||
return true;
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: ActivityVerbPostPlugin.php:138
|
||||
#. TRANS: Module description.
|
||||
#: ActivityVerbPostModule.php:138
|
||||
msgid "Post handling with ActivityStreams."
|
||||
msgstr ""
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Plugin to use crypt() for user password hashes
|
||||
* Module to use crypt() for user password hashes
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
@ -19,7 +19,7 @@
|
||||
* 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 Plugin
|
||||
* @category Module
|
||||
* @package GNUsocial
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @copyright 2012 StatusNet, Inc.
|
||||
@ -30,10 +30,10 @@
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
class AuthCryptPlugin extends AuthenticationPlugin
|
||||
class AuthCryptModule extends AuthenticationModule
|
||||
{
|
||||
const PLUGIN_VERSION = '2.0.0';
|
||||
protected $hash = '$6$'; // defaults to SHA512, i.e. '$6$', in onInitializePlugin()
|
||||
protected $hash = '$6$'; // defaults to SHA512, i.e. '$6$', in onInitializeModule()
|
||||
protected $statusnet = true; // if true, also check StatusNet style password hash
|
||||
protected $overwrite = true; // if true, password change means overwrite with crypt()
|
||||
protected $argon = false; // Use Argon if supported.
|
||||
@ -164,7 +164,7 @@ class AuthCryptPlugin extends AuthenticationPlugin
|
||||
|
||||
public function onCheckSchema()
|
||||
{
|
||||
// we only use the User database, so default AuthenticationPlugin stuff can be ignored
|
||||
// we only use the User database, so default AuthenticationModule stuff can be ignored
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -174,14 +174,14 @@ class AuthCryptPlugin extends AuthenticationPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onPluginVersion(array &$versions)
|
||||
public function onModuleVersion(array &$versions): bool
|
||||
{
|
||||
$versions[] = array('name' => 'AuthCrypt',
|
||||
'version' => self::PLUGIN_VERSION,
|
||||
'author' => 'Mikael Nordfeldth',
|
||||
'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/AuthCrypt',
|
||||
'rawdescription' =>
|
||||
// TRANS: Plugin description.
|
||||
// TRANS: Module description.
|
||||
_m('Authentication and password hashing with crypt()'));
|
||||
return true;
|
||||
}
|
@ -10,17 +10,17 @@ Add either of the following configurations to your config.php (see Example below
|
||||
|
||||
The recommended use is to overwrite old hash values when logging in (statusnet + overwrite modes) and be the authority on password checks when logging in. If you only wish to update entries on password change the default values are enough. 'statusnet' and 'overwrite' are true by default. 'authoritative' is only necessary if we want to exclude other plugins from verifying the password.
|
||||
|
||||
addPlugin('AuthCrypt');
|
||||
addModule('AuthCrypt');
|
||||
|
||||
To disable updating to crypt() on password change (and login with the 'statusnet' compatibility mode), simply set the 'overwrite' setting to false:
|
||||
|
||||
addPlugin('AuthCrypt', array(
|
||||
addModule('AuthCrypt', array(
|
||||
'overwrite'=>false,
|
||||
));
|
||||
|
||||
Settings
|
||||
========
|
||||
Default values in parenthesis. Many settings are inherited from the AuthenticationPlugin class.
|
||||
Default values in parenthesis. Many settings are inherited from the AuthenticationModule class.
|
||||
|
||||
authoritative (false): Set this to true when _all_ passwords are hashed with crypt()
|
||||
(warning: this may disable all other password verification, also when changing passwords!)
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:162
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:162
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: af\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ar\n"
|
||||
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ar_EG\n"
|
||||
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ast\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: be@tarask\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: bg\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: bn_IN\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: br\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ca\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: cs\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: da\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: de\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: el\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -18,7 +18,7 @@ msgstr ""
|
||||
"Language: en_GB\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr "Authentication and password hashing with crypt()"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: eo\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -18,7 +18,7 @@ msgstr ""
|
||||
"Language: es\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr "Autenticación y cifrado hash de contraseñas con crypt()"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: eu\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: fa\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: fi\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -18,7 +18,7 @@ msgstr ""
|
||||
"Language: fr\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr "Authentification et mot de passe avec hachage crypt()"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: fur\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: gl\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: he\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: hsb\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: hu\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: hy_AM\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ia\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -18,7 +18,7 @@ msgstr ""
|
||||
"Language: id\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr "Otentikasi dan hash sandi dengan crypt()"
|
||||
|
@ -18,7 +18,7 @@ msgstr ""
|
||||
"Language: io\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr "Autentikigo- e pasovorto-hacho per crypt()"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: is\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: it\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ja\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ka\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ko\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ksh\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==0) ? 0 : (n==1) ? 1 : 2;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: lb\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: lt\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: lv\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: mg\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: mk\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ml\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ms\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: my\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: nb\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ne\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: nl\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: nn\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: pl\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: pt\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: pt_BR\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ro_RO\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -18,7 +18,7 @@ msgstr ""
|
||||
"Language: ru\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr "Хэшинг авторизации и пароля при помощи crypt()"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: sl\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: sr\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -18,7 +18,7 @@ msgstr ""
|
||||
"Language: sv\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr "Autensiering och lösenordshashning med crypt()"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ta\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: te\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: tl\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: tr\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -18,7 +18,7 @@ msgstr ""
|
||||
"Language: uk\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr "Логін та пароль хешуються з crypt()"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: ur_PK\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: vi\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: zh\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: zh_CN\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Language: zh_TW\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: AuthCryptPlugin.php:157
|
||||
#. TRANS: Module description.
|
||||
#: AuthCryptModule.php:157
|
||||
msgid "Authentication and password hashing with crypt()"
|
||||
msgstr ""
|
||||
|
@ -23,7 +23,7 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
* @package Activity
|
||||
* @maintainer Mikael Nordfeldth <mmn@hethane.se>
|
||||
*/
|
||||
class FavoritePlugin extends ActivityVerbHandlerPlugin
|
||||
class FavoriteModule extends ActivityVerbHandlerModule
|
||||
{
|
||||
const PLUGIN_VERSION = '2.0.0';
|
||||
|
||||
@ -562,7 +562,7 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
|
||||
: new FavorForm($action, $target);
|
||||
}
|
||||
|
||||
public function onPluginVersion(array &$versions)
|
||||
public function onModuleVersion(array &$versions): bool
|
||||
{
|
||||
$versions[] = array('name' => 'Favorite',
|
||||
'version' => self::PLUGIN_VERSION,
|
@ -209,7 +209,7 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
$activity = new Activity($dom->documentElement);
|
||||
$notice = null;
|
||||
|
||||
// Favorite plugin handles these as ActivityHandlerPlugin through Notice->saveActivity
|
||||
// Favorite plugin handles these as ActivityHandlerModule through Notice->saveActivity
|
||||
// which in turn uses "StoreActivityObject" event.
|
||||
Event::handle('StartAtomPubNewActivity', array(&$activity, $this->scoped, &$notice));
|
||||
assert($notice instanceof Notice);
|
||||
|
@ -45,43 +45,43 @@ msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:421
|
||||
#: FavoriteModule.php:421
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:423
|
||||
#: FavoriteModule.php:423
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:473
|
||||
#: FavoriteModule.php:473
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:486
|
||||
#: FavoriteModule.php:486
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Page/dialog box title when a notice is marked as favorite already
|
||||
#: FavoritePlugin.php:508
|
||||
#: FavoriteModule.php:508
|
||||
msgctxt "TITLE"
|
||||
msgid "Unmark notice as favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Page/dialog box title when a notice is not marked as favorite
|
||||
#: FavoritePlugin.php:510
|
||||
#: FavoriteModule.php:510
|
||||
msgctxt "TITLE"
|
||||
msgid "Mark notice as favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:568
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:568
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
@ -31,31 +31,31 @@ msgid "Disfavor favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:415
|
||||
#: FavoriteModule.php:415
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:417
|
||||
#: FavoriteModule.php:417
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:469
|
||||
#: FavoriteModule.php:469
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:482
|
||||
#: FavoriteModule.php:482
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:508
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:508
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
@ -31,31 +31,31 @@ msgid "Disfavor favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:415
|
||||
#: FavoriteModule.php:415
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:417
|
||||
#: FavoriteModule.php:417
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:469
|
||||
#: FavoriteModule.php:469
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:482
|
||||
#: FavoriteModule.php:482
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr "محبوبة"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:508
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:508
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
@ -31,31 +31,31 @@ msgid "Disfavor favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:415
|
||||
#: FavoriteModule.php:415
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:417
|
||||
#: FavoriteModule.php:417
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:469
|
||||
#: FavoriteModule.php:469
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:482
|
||||
#: FavoriteModule.php:482
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:508
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:508
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
@ -31,31 +31,31 @@ msgid "Disfavor favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:415
|
||||
#: FavoriteModule.php:415
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:417
|
||||
#: FavoriteModule.php:417
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:469
|
||||
#: FavoriteModule.php:469
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:482
|
||||
#: FavoriteModule.php:482
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:508
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:508
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
@ -31,31 +31,31 @@ msgid "Disfavor favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:415
|
||||
#: FavoriteModule.php:415
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:417
|
||||
#: FavoriteModule.php:417
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:469
|
||||
#: FavoriteModule.php:469
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:482
|
||||
#: FavoriteModule.php:482
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:508
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:508
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
@ -31,31 +31,31 @@ msgid "Disfavor favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:415
|
||||
#: FavoriteModule.php:415
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:417
|
||||
#: FavoriteModule.php:417
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:469
|
||||
#: FavoriteModule.php:469
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:482
|
||||
#: FavoriteModule.php:482
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:508
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:508
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
@ -31,31 +31,31 @@ msgid "Disfavor favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:415
|
||||
#: FavoriteModule.php:415
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:417
|
||||
#: FavoriteModule.php:417
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:469
|
||||
#: FavoriteModule.php:469
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:482
|
||||
#: FavoriteModule.php:482
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:508
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:508
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
@ -31,31 +31,31 @@ msgid "Disfavor favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:415
|
||||
#: FavoriteModule.php:415
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:417
|
||||
#: FavoriteModule.php:417
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:469
|
||||
#: FavoriteModule.php:469
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:482
|
||||
#: FavoriteModule.php:482
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr "Poblek"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:508
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:508
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
@ -31,31 +31,31 @@ msgid "Disfavor favorite"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav <nickname>".
|
||||
#: FavoritePlugin.php:415
|
||||
#: FavoriteModule.php:415
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add user's last notice as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Help message for IM/SMS command "fav #<notice_id>".
|
||||
#: FavoritePlugin.php:417
|
||||
#: FavoriteModule.php:417
|
||||
msgctxt "COMMANDHELP"
|
||||
msgid "add notice with the given id as a 'fave'"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in personal group navigation menu.
|
||||
#: FavoritePlugin.php:469
|
||||
#: FavoriteModule.php:469
|
||||
msgctxt "MENU"
|
||||
msgid "Favorites"
|
||||
msgstr ""
|
||||
|
||||
#. TRANS: Menu item in search group navigation panel.
|
||||
#: FavoritePlugin.php:482
|
||||
#: FavoriteModule.php:482
|
||||
msgctxt "MENU"
|
||||
msgid "Popular"
|
||||
msgstr "Populars"
|
||||
|
||||
#. TRANS: Plugin description.
|
||||
#: FavoritePlugin.php:508
|
||||
#. TRANS: Module description.
|
||||
#: FavoriteModule.php:508
|
||||
msgid "Favorites (likes) using ActivityStreams."
|
||||
msgstr ""
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user