Skip to content

Commit

Permalink
Merge pull request #99 from ticktackk/develop
Browse files Browse the repository at this point in the history
2.0.16
  • Loading branch information
ticktackk authored Aug 7, 2024
2 parents ec36f81 + 9007ad4 commit 3bf3a35
Show file tree
Hide file tree
Showing 33 changed files with 139 additions and 256 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
CHANGELOG
==========================

## 2.0.16 (`2001670`)

- **Change:** Change permission names to be consistent with that of XenForo itself (#94)
- **Change:** When inline editing post, form row is not using full width (#96)
- **Change:** Switch to native HTML controls on both XF 2.2 and 2.3 (#97)
- **Fix:** `\[E_DEPRECATED\]` Use of "parent" in callables is deprecated (#95)

## 2.0.15 (`2001570`)

- **Fix:** Slow upgrade query causes timeouts on large boards (#92)
Expand Down
17 changes: 12 additions & 5 deletions ControllerPlugin/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function extendContentEditAction(AbstractReply $reply, string $contentPar
{
$handler = $content->getChangeOwnerHandler(true);
$reply->setParam('changeOwnerHandler', $handler);
$reply->setParam('tckCCO_fullWidth', $this->filter('_xfWithData', 'bool'));
}
}
}
Expand Down Expand Up @@ -163,11 +164,17 @@ protected function setNewOwnerDateTimeAndInterval(AbstractService $service, Cont
$changeTime = $this->filter('change_time', 'bool');
if ($changeTime)
{
$service->setNewTime($filterArray('new_time', [
'hour' => 'int',
'minute' => 'int',
'second' => 'int'
]));
$newTimeArr = ['hour' => null, 'minute' => null, 'second' => null]; // fallback
$newTimeStr = $this->filter('new_time', 'str');
if (substr_count($newTimeStr, ':') === 2)
{
[$hour, $minute, $second] = explode(':', $newTimeStr);
$newTimeArr['hour'] = (int) $hour;
$newTimeArr['minute'] = (int) $minute;
$newTimeArr['second'] = (int) $second;
}

$service->setNewTime($newTimeArr);
}

$applyTimeInterval = $this->filter('apply_time_interval', 'bool');
Expand Down
16 changes: 11 additions & 5 deletions InlineMod/AbstractOwnerChangerAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,17 @@ public function getFormOptions(AbstractCollection $entities, Request $request) :
'day' => null
];
}
$options['new_time'] = $filterArray('new_time', [
'hour' => 'int',
'minute' => 'int',
'second' => 'int'
]);

$options['new_time'] = ['hour' => null, 'minute' => null, 'second' => null]; // fallback
$newTimeStr = $request->filter('new_time', 'str');
if (substr_count($newTimeStr, ':') === 2)
{
[$hour, $minute, $second] = explode(':', $newTimeStr);
$options['new_time']['hour'] = (int) $hour;
$options['new_time']['minute'] = (int) $minute;
$options['new_time']['second'] = (int) $second;
}

$options['time_interval'] = $filterArray('time_interval', [
'hour' => 'int',
'minute' => 'int',
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018-2022 TickTackk
Copyright (c) 2018-2024 TickTackk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,34 @@ Options
Permissions
-----------

#### XFMG: Album moderator permissions
#### Forum moderator permissions

- Can change album owner
- Can change album date
- Change thread owner
- Change thread date
- Change post owner
- Change post date

#### Profile post moderator permissions

- Can change profile post owner
- Can change profile post date
- Can change profile post comment owner
- Can change profile post comment date
- Change profile post owner
- Change profile post date
- Change profile post comment owner
- Change profile post comment date

#### XFMG: Media moderator permissions

- Can change media owner
- Can change media date
- Change media owner
- Change media date

#### XFMG: Comment moderator permissions
#### XFMG: Album moderator permissions

- Can change comment owner
- Can change comment date
- Change album owner
- Change album date

#### Forum moderator permissions
#### XFMG: Comment moderator permissions

- Can change thread owner
- Can change thread date
- Can change post owner
- Can change post date
- Change comment owner
- Change comment date

License
-------
Expand Down
4 changes: 2 additions & 2 deletions Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -748,9 +748,9 @@ protected function jobManager() : JobManager
*/
protected function app() : BaseApp
{
if (!\is_callable('parent::app'))
if (method_exists(get_parent_class($this), 'app'))
{
return $this->app;
return parent::app();
}

return parent::app();
Expand Down
2 changes: 1 addition & 1 deletion _dev/resource_description.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<h1>Change Content Owner or Date for XenForo 2.0.10+</h1><h2>Description</h2><p>This add-on allows you to change the owner of content or the timestamp content.</p><h2>Requirements</h2><ul><li>PHP 7.1.0+</li></ul><h2>Options</h2><h4>Change content owner</h4><table style="width:100%"><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td>Default time interval</td><td></td></tr></tbody></table><h2>Permissions</h2><h4>XFMG: Album moderator permissions</h4><ul><li>Can change album owner</li><li>Can change album date</li></ul><h4>Profile post moderator permissions</h4><ul><li>Can change profile post owner</li><li>Can change profile post date</li><li>Can change profile post comment owner</li><li>Can change profile post comment date</li></ul><h4>XFMG: Media moderator permissions</h4><ul><li>Can change media owner</li><li>Can change media date</li></ul><h4>XFMG: Comment moderator permissions</h4><ul><li>Can change comment owner</li><li>Can change comment date</li></ul><h4>Forum moderator permissions</h4><ul><li>Can change thread owner</li><li>Can change thread date</li><li>Can change post owner</li><li>Can change post date</li></ul><h2>License</h2>
<h1>Change Content Owner or Date for XenForo 2.0.10+</h1><h2>Description</h2><p>This add-on allows you to change the owner of content or the timestamp content.</p><h2>Requirements</h2><ul><li>PHP 7.1.0+</li></ul><h2>Options</h2><h4>Change content owner</h4><table style="width:100%"><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td>Default time interval</td><td></td></tr></tbody></table><h2>Permissions</h2><h4>Forum moderator permissions</h4><ul><li>Change thread owner</li><li>Change thread date</li><li>Change post owner</li><li>Change post date</li></ul><h4>Profile post moderator permissions</h4><ul><li>Change profile post owner</li><li>Change profile post date</li><li>Change profile post comment owner</li><li>Change profile post comment date</li></ul><h4>XFMG: Media moderator permissions</h4><ul><li>Change media owner</li><li>Change media date</li></ul><h4>XFMG: Album moderator permissions</h4><ul><li>Change album owner</li><li>Change album date</li></ul><h4>XFMG: Comment moderator permissions</h4><ul><li>Change comment owner</li><li>Change comment date</li></ul><h2>License</h2>
This project is licensed under the MIT License - see the <a href="https://github.com/ticktackk/ChangeContentOwnerForXF2/blob/master/LICENSE.md">LICENSE.md</a> file for details.
59 changes: 29 additions & 30 deletions _dev/resource_description.txt
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
[HEADING=1]Change Content Owner or Date for XenForo 2.0.10+[/HEADING]
[HEADING=1]Description[/HEADING]
[H1]Change Content Owner or Date for XenForo 2.0.10+[/H1]
[H2]Description[/H2]
This add-on allows you to change the owner of content or the timestamp content.
[HEADING=1]Requirements[/HEADING]
[H2]Requirements[/H2]
[LIST]
[*]PHP 7.1.0+
[/LIST]
[HEADING=1]Options[/HEADING]
[HEADING=3]Change content owner[/HEADING]
[TABLE]
[H2]Options[/H2]
[H4]Change content owner[/H4]
[TABLE width="100%"]
[TR]
[TH]Name[/TH]
[TH]Description[/TH]
[th]Name[/th][th]Description[/th]
[/TR]
[TR]
[TD]Default time interval[/TD]
[td]Default time interval[/td]
[/TR]
[/TABLE]
[HEADING=1]Permissions[/HEADING]
[HEADING=3]XFMG: Album moderator permissions[/HEADING]
[H2]Permissions[/H2]
[H4]Forum moderator permissions[/H4]
[LIST]
[*]Can change album owner
[*]Can change album date
[*]Change thread owner
[*]Change thread date
[*]Change post owner
[*]Change post date
[/LIST]
[HEADING=3]Profile post moderator permissions[/HEADING]
[H4]Profile post moderator permissions[/H4]
[LIST]
[*]Can change profile post owner
[*]Can change profile post date
[*]Can change profile post comment owner
[*]Can change profile post comment date
[*]Change profile post owner
[*]Change profile post date
[*]Change profile post comment owner
[*]Change profile post comment date
[/LIST]
[HEADING=3]XFMG: Media moderator permissions[/HEADING]
[H4]XFMG: Media moderator permissions[/H4]
[LIST]
[*]Can change media owner
[*]Can change media date
[*]Change media owner
[*]Change media date
[/LIST]
[HEADING=3]XFMG: Comment moderator permissions[/HEADING]
[H4]XFMG: Album moderator permissions[/H4]
[LIST]
[*]Can change comment owner
[*]Can change comment date
[*]Change album owner
[*]Change album date
[/LIST]
[HEADING=3]Forum moderator permissions[/HEADING]
[H4]XFMG: Comment moderator permissions[/H4]
[LIST]
[*]Can change thread owner
[*]Can change thread date
[*]Can change post owner
[*]Can change post date
[*]Change comment owner
[*]Change comment date
[/LIST]
[HEADING=1]License[/HEADING]
[H2]License[/H2]
This project is licensed under the MIT License - see the [URL='https://github.com/ticktackk/ChangeContentOwnerForXF2/blob/master/LICENSE.md']LICENSE.md[/URL] file for details.
1 change: 1 addition & 0 deletions _output/extension_hint.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

/** @noinspection PhpIllegalPsrClassPathInspection */
// ################## THIS IS A GENERATED FILE ##################
// DO NOT EDIT DIRECTLY. EDIT THE CLASS EXTENSIONS IN THE CONTROL PANEL.

Expand Down
2 changes: 1 addition & 1 deletion _output/phrases/permission.forum_changePostDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change post date
Change post date
2 changes: 1 addition & 1 deletion _output/phrases/permission.forum_changePostOwner.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change post owner
Change post owner
2 changes: 1 addition & 1 deletion _output/phrases/permission.forum_changeThreadDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change thread date
Change thread date
2 changes: 1 addition & 1 deletion _output/phrases/permission.forum_changeThreadOwner.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change thread owner
Change thread owner
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change profile post comment date
Change profile post comment date
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change profile post comment owner
Change profile post comment owner
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change profile post date
Change profile post date
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change profile post owner
Change profile post owner
2 changes: 1 addition & 1 deletion _output/phrases/permission.xfmg_changeAlbumDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change album date
Change album date
2 changes: 1 addition & 1 deletion _output/phrases/permission.xfmg_changeAlbumOwner.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change album owner
Change album owner
2 changes: 1 addition & 1 deletion _output/phrases/permission.xfmg_changeCommentDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change comment date
Change comment date
2 changes: 1 addition & 1 deletion _output/phrases/permission.xfmg_changeCommentOwner.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change comment owner
Change comment owner
2 changes: 1 addition & 1 deletion _output/phrases/permission.xfmg_changeMediaDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change media date
Change media date
2 changes: 1 addition & 1 deletion _output/phrases/permission.xfmg_changeMediaOwner.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Can change media owner
Change media owner
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"enabled": true,
"action": "preg_replace",
"find": "#<xf:if is=\"\\$post\\.canSendModeratorActionAlert\\(\\).*?\">.*?<\\/xf:if>#si",
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$post}\"\n\t\t arg-forceHR=\"{{ true }}\" />"
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$post}\"\n\t\t arg-forceHR=\"{{ true }}\"\n\t\t arg-fullWidth=\"{$tckCCO_fullWidth}\" />"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"enabled": true,
"action": "preg_replace",
"find": "#<xf:if is=\"\\$comment\\.canSendModeratorActionAlert\\(\\).*?\">.*?<\\/xf:if>#si",
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$comment}\"\n\t\t arg-forceHR=\"{{ true }}\" />"
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$comment}\"\n\t\t arg-forceHR=\"{{ true }}\"\n\t\t arg-fullWidth=\"{$tckCCO_fullWidth}\" />"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"enabled": true,
"action": "preg_replace",
"find": "#<xf:if is=\"\\$profilePost\\.canSendModeratorActionAlert\\(\\).*?\">.*?<\\/xf:if>#si",
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$profilePost}\"\n\t\t arg-forceHR=\"{{ true }}\" />"
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$profilePost}\"\n\t\t arg-forceHR=\"{{ true }}\"\n\t\t arg-fullWidth=\"{$tckCCO_fullWidth}\" />"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"enabled": true,
"action": "preg_replace",
"find": "#<xf:macro template=\"helper_thread_options\" name=\"thread_status\".*?\\/>#si",
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$thread}\"\n\t\t arg-forceHR=\"{{ true }}\" />"
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$thread}\"\n\t\t arg-forceHR=\"{{ true }}\"\n\t\t arg-fullWidth=\"{$tckCCO_fullWidth}\" />"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"enabled": true,
"action": "preg_replace",
"find": "#<xf:if is=\"\\$album\\.canSendModeratorActionAlert\\(\\).*?\">.*?<\\/xf:if>#si",
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$album}\"\n\t\t arg-forceHR=\"{{ true }}\" />"
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$album}\"\n\t\t arg-forceHR=\"{{ true }}\"\n\t\t arg-fullWidth=\"{$tckCCO_fullWidth}\" />"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"enabled": true,
"action": "preg_replace",
"find": "#<xf:if is=\"\\$comment\\.canSendModeratorActionAlert\\(\\).*?\">.*?<\\/xf:if>#si",
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$comment}\"\n\t\t arg-forceHR=\"{{ true }}\" />"
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$comment}\"\n\t\t arg-forceHR=\"{{ true }}\"\n\t\t arg-fullWidth=\"{$tckCCO_fullWidth}\" />"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"enabled": true,
"action": "preg_replace",
"find": "#<xf:if is=\"\\$mediaItem\\.canSendModeratorActionAlert\\(\\).*?\">.*?<\\/xf:if>#si",
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$mediaItem}\"\n\t\t arg-forceHR=\"{{ true }}\" />"
"replace": "$0\n\n<xf:macro template=\"tckChangeContentOwner_macros\"\n\t\t name=\"change_rows\"\n\t\t arg-handler=\"{$changeOwnerHandler}\"\n\t\t arg-content=\"{$mediaItem}\"\n\t\t arg-forceHR=\"{{ true }}\"\n\t\t arg-fullWidth=\"{$tckCCO_fullWidth}\" />"
}
Loading

0 comments on commit 3bf3a35

Please sign in to comment.