Skip to content

Commit

Permalink
Added claim filed notification for infringing member (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonerickson authored Aug 29, 2023
1 parent 6dc2426 commit 1c12d5a
Show file tree
Hide file tree
Showing 24 changed files with 364 additions and 44 deletions.
1 change: 1 addition & 0 deletions src/data/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<setting key="dcma_warning_posting_restriction"><![CDATA[{"key":"dcma_warning_posting_restriction","default":""}]]></setting>
<setting key="dmca_approval_email"><![CDATA[{"key":"dmca_approval_email","default":""}]]></setting>
<setting key="dmca_automatic_deletion"><![CDATA[{"key":"dmca_automatic_deletion","default":""}]]></setting>
<setting key="dmca_claim_filed_email"><![CDATA[{"key":"dmca_claim_filed_email","default":""}]]></setting>
<setting key="dmca_claim_intro"><![CDATA[{"key":"dmca_claim_intro","default":""}]]></setting>
<setting key="dmca_deleted_email"><![CDATA[{"key":"dmca_deleted_email","default":""}]]></setting>
<setting key="dmca_denied_email"><![CDATA[{"key":"dmca_denied_email","default":""}]]></setting>
Expand Down
14 changes: 14 additions & 0 deletions src/data/emails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>]]></template_content_html><template_data>$message, $report, $email</template_data><template_content_plaintext>{$message|raw}
{$report|raw}

-- {setting="board_name"}</template_content_plaintext><template_pinned>0</template_pinned></template><template><template_app>dmca</template_app><template_name>notification_filed</template_name><template_content_html><![CDATA[{$message|raw}
{$report|raw}
<br>
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>]]></template_content_html><template_data>$message, $email</template_data><template_content_plaintext>{$message|raw}

-- {setting="board_name"}</template_content_plaintext><template_pinned>0</template_pinned></template><template><template_app>dmca</template_app><template_name>denied</template_name><template_content_html><![CDATA[<strong style="font-size: 17px">Hi {$name},</strong>
<br>
{$message|raw}
Expand Down Expand Up @@ -47,6 +52,15 @@
{$message|raw}
{$report|raw}

-- {setting="board_name"}</template_content_plaintext><template_pinned>0</template_pinned></template><template><template_app>dmca</template_app><template_name>filed</template_name><template_content_html><![CDATA[<strong style="font-size: 17px">Hi {$name},</strong>
<br>
{$message|raw}
{$report|raw}
<br>
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>]]></template_content_html><template_data>$name, $message, $report, $email</template_data><template_content_plaintext>Hi {$name},
{$message|raw}
{$report|raw}

-- {setting="board_name"}</template_content_plaintext><template_pinned>0</template_pinned></template><template><template_app>dmca</template_app><template_name>notification_firststrike</template_name><template_content_html><![CDATA[{$message|raw}
{$report|raw}
<br>
Expand Down
1 change: 1 addition & 0 deletions src/data/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"core": {
"EditorLocations": {
"ApprovalEmail": "IPS\\dmca\\extensions\\core\\EditorLocations\\ApprovalEmail",
"ClaimFiledEmail": "IPS\\dmca\\extensions\\core\\EditorLocations\\ClaimFiledEmail",
"ClaimIntro": "IPS\\dmca\\extensions\\core\\EditorLocations\\ClaimIntro",
"DeletedEmail": "IPS\\dmca\\extensions\\core\\EditorLocations\\DeletedEmail",
"DeniedEmail": "IPS\\dmca\\extensions\\core\\EditorLocations\\DeniedEmail",
Expand Down
10 changes: 6 additions & 4 deletions src/data/lang.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="dmca" version="10001">
<app key="dmca" version="10002">
<word key="__app_dmca" js="0">DMCA Copyright Claim Manager</word>
<word key="menutab__dmca" js="0">DMCA Manager</word>
<word key="menutab__dmca_icon" js="0">flag</word>
Expand All @@ -17,9 +17,10 @@
<word key="mailsub__dmca_notification_onhold" js="0">Your copyright claim was placed on hold</word>
<word key="mailsub__dmca_notification_denied" js="0">Your copyright claim was denied</word>
<word key="mailsub__dmca_notification_deleted" js="0">The item in your copyright claim has been deleted</word>
<word key="mailsub__dmca_notification_firststrike" js="0">A copyright claim has been filed against some content you posted - first strike</word>
<word key="mailsub__dmca_notification_secondstrike" js="0">A copyright claim has been filed against some content you posted - second strike</word>
<word key="mailsub__dmca_notification_thirdstrike" js="0">A copyright claim has been filed against some content you posted - last strike</word>
<word key="mailsub__dmca_notification_filed" js="0">A copyright claim has been filed against some content you posted</word>
<word key="mailsub__dmca_notification_firststrike" js="0">The copyright claim that was filed against some content you posted was approved. This is your first strike</word>
<word key="mailsub__dmca_notification_secondstrike" js="0">The copyright claim that was filed against some content you posted was approved. This is your second strike</word>
<word key="mailsub__dmca_notification_thirdstrike" js="0">The copyright claim that was filed against some content you posted was approved. This is your last strike</word>
<word key="mailsub__dmca_submitted" js="0">Your copyright claim was submitted</word>
<word key="mailsub__dmca_approved" js="0">Your copyright claim was approved</word>
<word key="mailsub__dmca_onhold" js="0">Your copyright claim was placed on hold</word>
Expand Down Expand Up @@ -75,6 +76,7 @@
<word key="dmca_submitted_email" js="0">Default Claim Submitted Email</word>
<word key="dmca_submitted_email_desc" js="0">The email that will be sent when a copyright claim is submitted.</word>
<word key="dmca_settings_tab_strike_notifications" js="0">Infringing Member Notifications</word>
<word key="dmca_claim_filed_email" js="0">Claim Filed Email</word>
<word key="dmca_first_strike_email" js="0">First Strike Email</word>
<word key="dmca_second_strike_email" js="0">Second Strike Email</word>
<word key="dmca_third_strike_email" js="0">Third Strike Email</word>
Expand Down
24 changes: 12 additions & 12 deletions src/data/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,6 @@
"unsigned": false,
"auto_increment": false
},
"description": {
"name": "description",
"type": "TEXT",
"length": null,
"decimals": null,
"values": null,
"allow_null": true,
"default": null,
"comment": "",
"unsigned": false,
"auto_increment": false
},
"updated_at": {
"name": "updated_at",
"type": "INT",
Expand Down Expand Up @@ -179,6 +167,18 @@
"comment": "",
"unsigned": false,
"auto_increment": false
},
"description_work": {
"name": "description_work",
"type": "TEXT",
"length": null,
"decimals": null,
"values": null,
"allow_null": true,
"default": null,
"comment": "",
"unsigned": false,
"auto_increment": false
}
},
"indexes": {
Expand Down
4 changes: 4 additions & 0 deletions src/data/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
"key": "dmca_automatic_deletion",
"default": ""
},
{
"key": "dmca_claim_filed_email",
"default": ""
},
{
"key": "dmca_claim_intro",
"default": ""
Expand Down
8 changes: 5 additions & 3 deletions src/data/theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;"><strong>Address:</strong></td>
<td dir="ltr" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px;">{address="$report->address"}</td>
</tr>
<tr class="responsive_row">
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;"><strong>Digital Signature:</strong></td>
<td dir="ltr" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px;">{$report->signature}</td>
</tr>
<tr class="responsive_row">
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;"><strong>Describe The Original Work:</strong></td>
<td dir="ltr" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px;">{$report->description|raw}</td>
</tr>
<tr class="responsive_row">
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;"><strong>Digital Signature:</strong></td>
<td dir="ltr" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px;">{$report->signature}</td>
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;">{$report->description_work|raw}</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 2 additions & 1 deletion src/data/versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"10000": "1.0.0",
"10001": "1.0.1"
"10001": "1.0.1",
"10002": "1.0.2"
}
7 changes: 7 additions & 0 deletions src/dev/email/filed.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<ips:template parameters="$name, $message, $report, $email" />
<strong style="font-size: 17px">Hi {$name},</strong>
<br>
{$message|raw}
{$report|raw}
<br>
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>
6 changes: 6 additions & 0 deletions src/dev/email/filed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ips:template parameters="$name, $message, $report, $email" />
Hi {$name},
{$message|raw}
{$report|raw}

-- {setting="board_name"}
5 changes: 5 additions & 0 deletions src/dev/email/notification_filed.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ips:template parameters="$message, $report, $email" />
{$message|raw}
{$report|raw}
<br>
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>
4 changes: 4 additions & 0 deletions src/dev/email/notification_filed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<ips:template parameters="$message, $email" />
{$message|raw}

-- {setting="board_name"}
8 changes: 5 additions & 3 deletions src/dev/html/front/report/report.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;"><strong>Address:</strong></td>
<td dir="ltr" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px;">{address="$report->address"}</td>
</tr>
<tr class="responsive_row">
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;"><strong>Digital Signature:</strong></td>
<td dir="ltr" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px;">{$report->signature}</td>
</tr>
<tr class="responsive_row">
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;"><strong>Describe The Original Work:</strong></td>
<td dir="ltr" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px;">{$report->description|raw}</td>
</tr>
<tr class="responsive_row">
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;"><strong>Digital Signature:</strong></td>
<td dir="ltr" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px;">{$report->signature}</td>
<td dir="ltr" width="250" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; vertical-align: top;">{$report->description_work|raw}</td>
</tr>
</tbody>
</table>
Expand Down
8 changes: 5 additions & 3 deletions src/dev/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
'mailsub__dmca_notification_onhold' => 'Your copyright claim was placed on hold',
'mailsub__dmca_notification_denied' => 'Your copyright claim was denied',
'mailsub__dmca_notification_deleted' => 'The item in your copyright claim has been deleted',
'mailsub__dmca_notification_firststrike' => 'A copyright claim has been filed against some content you posted - first strike',
'mailsub__dmca_notification_secondstrike' => 'A copyright claim has been filed against some content you posted - second strike',
'mailsub__dmca_notification_thirdstrike' => 'A copyright claim has been filed against some content you posted - last strike',
'mailsub__dmca_notification_filed' => 'A copyright claim has been filed against some content you posted',
'mailsub__dmca_notification_firststrike' => 'The copyright claim that was filed against some content you posted was approved. This is your first strike',
'mailsub__dmca_notification_secondstrike' => 'The copyright claim that was filed against some content you posted was approved. This is your second strike',
'mailsub__dmca_notification_thirdstrike' => 'The copyright claim that was filed against some content you posted was approved. This is your last strike',

'mailsub__dmca_submitted' => 'Your copyright claim was submitted',
'mailsub__dmca_approved' => 'Your copyright claim was approved',
Expand Down Expand Up @@ -85,6 +86,7 @@
'dmca_submitted_email' => 'Default Claim Submitted Email',
'dmca_submitted_email_desc' => 'The email that will be sent when a copyright claim is submitted.',
'dmca_settings_tab_strike_notifications' => 'Infringing Member Notifications',
'dmca_claim_filed_email' => 'Claim Filed Email',
'dmca_first_strike_email' => 'First Strike Email',
'dmca_second_strike_email' => 'Second Strike Email',
'dmca_third_strike_email' => 'Third Strike Email',
Expand Down
130 changes: 130 additions & 0 deletions src/extensions/core/EditorLocations/ClaimFiledEmail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?php
/**
* @brief Editor Extension: ClaimFiledEmail
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage DMCA Copyright Claim Manager
* @since 29 Aug 2023
*/

namespace IPS\dmca\extensions\core\EditorLocations;

/* To prevent PHP errors (extending class does not exist) revealing path */
if (!\defined('\IPS\SUITE_UNIQUE_KEY')) {
header((isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0') . ' 403 Forbidden');
exit;
}

/**
* Editor Extension: ClaimFiledEmail
*/
class _ClaimFiledEmail
{
/**
* Can we use HTML in this editor?
*
* @param \IPS\Member $member The member
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canUseHtml($member)
{
return false;
}

/**
* Can we use attachments in this editor?
*
* @param \IPS\Member $member The member
* @param \IPS\Helpers\Form\Editor $field The editor field
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canAttach($member, $field)
{
return false;
}

/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck($member, $id1, $id2, $id3, $attachment, $viewOnly=false): bool
{
/* Make sure that you add a relevant permission check to prevent attachments being accessed via ID enumeration. */
return true;
}

/**
* Attachment lookup
*
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @return \IPS\Http\Url|\IPS\Content|\IPS\Node\Model
* @throws \LogicException
*/
public function attachmentLookup($id1, $id2, $id3)
{
// return \IPS\Http\Url::internal( ... );
}

/**
* Rebuild attachment images in non-content item areas
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
//public function rebuildAttachmentImages( $offset, $max )
//{
//}

/**
* Rebuild content post-upgrade
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
//public function rebuildContent( $offset, $max )
//{
//}

/**
* @brief Store lazy loading status ( true = enabled )
*/
protected $_lazyLoadStatus = null;

/**
* Rebuild content to add or remove lazy loading
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @param bool $status Enable/Disable lazy loading
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
//public function rebuildLazyLoad( $offset, $max, $status=TRUE )
//{
//}

/**
* Total content count to be used in progress indicator
*
* @return int Total Count
*/
//public function contentCount()
//{
// return \IPS\Db::i()->select( 'COUNT(*) as count', '...', "..." )->setKeyField('count')->first();
//}
}
Loading

0 comments on commit 1c12d5a

Please sign in to comment.