X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FModLog%2FModLogPlugin.php;h=84912ac914366ceb754679b6e5a8f213ef1bccd4;hb=93524c4be384a9d75cdb4cd3413894bb4e39de6b;hp=f5373aa947663147513b97492898a9ef54568476;hpb=220b51d8be61e9bd316567f3ad03fffdbc4b7526;p=quix0rs-gnu-social.git diff --git a/plugins/ModLog/ModLogPlugin.php b/plugins/ModLog/ModLogPlugin.php index f5373aa947..84912ac914 100644 --- a/plugins/ModLog/ModLogPlugin.php +++ b/plugins/ModLog/ModLogPlugin.php @@ -101,10 +101,10 @@ class ModLogPlugin extends Plugin $modlog->profile_id = $profile->id; - $cur = common_current_user(); + $scoped = Profile::current(); - if (!empty($cur)) { - $modlog->moderator_id = $cur->id; + if ($scoped instanceof Profile) { + $modlog->moderator_id = $scoped->getID(); } $modlog->role = $role; @@ -116,23 +116,24 @@ class ModLogPlugin extends Plugin return true; } - function onEndShowSections($action) + function onEndShowSections(Action $action) { - if ($action->arg('action') != 'showstream') { + if (!$action instanceof ShowstreamAction) { + // early return for actions we're not interested in return true; } - $cur = common_current_user(); - - if (empty($cur) || !$cur->hasRight(self::VIEWMODLOG)) { + $scoped = $action->getScoped(); + if (!$scoped instanceof Profile || !$scoped->hasRight(self::VIEWMODLOG)) { + // only continue if we are allowed to VIEWMODLOG return true; } - $profile = $action->profile; + $profile = $action->getTarget(); $ml = new ModLog(); - $ml->profile_id = $profile->id; + $ml->profile_id = $profile->getID(); $ml->orderBy("created"); $cnt = $ml->find(); @@ -152,13 +153,13 @@ class ModLogPlugin extends Plugin $action->element('td', null, sprintf(($ml->is_grant) ? _('+%s') : _('-%s'), $ml->role)); $action->elementStart('td'); if ($ml->moderator_id) { - $mod = Profile::getKV('id', $ml->moderator_id); + $mod = Profile::getByID($ml->moderator_id); if (empty($mod)) { $action->text(_('[unknown]')); } else { - $action->element('a', array('href' => $mod->profileurl, - 'title' => $mod->fullname), - $mod->nickname); + $action->element('a', array('href' => $mod->getUrl(), + 'title' => $mod->getFullname()), + $mod->getNickname()); } } else { $action->text(_('[unknown]')); @@ -183,12 +184,12 @@ class ModLogPlugin extends Plugin } } - function onPluginVersion(&$versions) + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'ModLog', 'version' => GNUSOCIAL_VERSION, 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:ModLog', + 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/ModLog', 'description' => _m('Show the moderation history for a profile in the sidebar')); return true;