-
Notifications
You must be signed in to change notification settings - Fork 5
Port Anti-Spam Links to SMF 2.1.x #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hoidulich
wants to merge
4
commits into
SimpleMachines:master
Choose a base branch
from
hoidulich:anti-spam-links-smf21
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
anti-spam-links/SMF-2.1/Themes/default/languages/AntiSpamLinks.english.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <?php | ||
|
|
||
| global $boardurl; | ||
|
|
||
| $txt['anti_spam_links'] = 'Anti-Spam Links'; | ||
| $txt['error_anti_spam_links_nolinks_guest'] = 'Sorry, guests are not allowed to post external links.'; | ||
| $txt['error_anti_spam_links_nolinks_member'] = 'Sorry, you are not allowed to post external links yet.'; | ||
| $txt['anti_spam_links_newbielink'] = ' newbielink:'; | ||
| $txt['anti_spam_links_nonactive'] = '[nonactive]'; | ||
| $txt['anti_spam_links_newbielinks_info'] = 'To curb spam posts, external links stay [nonactive] until %1$s posts.'; | ||
| $txt['anti_spam_links_nofollowlinks_info'] = 'To curb spam posts, external links stay [nofollow] until %1$s posts.'; | ||
| $txt['anti_spam_links_guests_nonactive_info'] = 'To curb spam posts, guest external links are shown as [nonactive].'; | ||
| $txt['anti_spam_links_guests_nofollow_info'] = 'To curb spam posts, guest external links are shown as [nofollow].'; | ||
| $txt['anti_spam_links_nofollow'] = '[nofollow]'; | ||
| $txt['anti_spam_links_nolinks'] = 'Post count under which members cannot post external links'; | ||
| $txt['anti_spam_links_newbielinks'] = 'Post count under which members external links are shown [nonactive] and without http://'; | ||
| $txt['anti_spam_links_nofollowlinks'] = 'Post count under which members external links are set [nofollow]'; | ||
| $txt['anti_spam_links_zero_disable'] = '[Internal links are excluded: ' . $boardurl . ']<br>(Use 0 to disable)'; | ||
| $txt['anti_spam_links_guests'] = 'Guests...'; | ||
| $txt['anti_spam_links_guests_opt0'] = '(disable mod for guests)'; | ||
| $txt['anti_spam_links_guests_opt1'] = 'cannot post links'; | ||
| $txt['anti_spam_links_guests_opt2'] = 'links are shown [nonactive]'; | ||
| $txt['anti_spam_links_guests_opt3'] = 'links are set [nofollow]'; | ||
|
|
24 changes: 24 additions & 0 deletions
24
anti-spam-links/SMF-2.1/Themes/default/languages/AntiSpamLinks.vietnamese.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <?php | ||
|
|
||
| global $boardurl; | ||
|
|
||
| $txt['anti_spam_links'] = 'Chong spam lien ket'; | ||
| $txt['error_anti_spam_links_nolinks_guest'] = 'Xin loi, khach khong duoc dang lien ket ben ngoai.'; | ||
| $txt['error_anti_spam_links_nolinks_member'] = 'Xin loi, ban chua duoc phep dang lien ket ben ngoai.'; | ||
| $txt['anti_spam_links_newbielink'] = ' newbielink:'; | ||
| $txt['anti_spam_links_nonactive'] = '[nonactive]'; | ||
| $txt['anti_spam_links_newbielinks_info'] = 'De giam spam, lien ket ben ngoai se o trang thai [nonactive] cho toi khi dat %1$s bai viet.'; | ||
| $txt['anti_spam_links_nofollowlinks_info'] = 'De giam spam, lien ket ben ngoai se duoc them [nofollow] cho toi khi dat %1$s bai viet.'; | ||
| $txt['anti_spam_links_guests_nonactive_info'] = 'De giam spam, lien ket cua khach se duoc hien thi o dang [nonactive].'; | ||
| $txt['anti_spam_links_guests_nofollow_info'] = 'De giam spam, lien ket cua khach se duoc hien thi o dang [nofollow].'; | ||
| $txt['anti_spam_links_nofollow'] = '[nofollow]'; | ||
| $txt['anti_spam_links_nolinks'] = 'So bai viet toi thieu de thanh vien duoc dang lien ket ben ngoai'; | ||
| $txt['anti_spam_links_newbielinks'] = 'So bai viet toi thieu de lien ket ben ngoai hien [nonactive] va khong hien http://'; | ||
| $txt['anti_spam_links_nofollowlinks'] = 'So bai viet toi thieu de lien ket ben ngoai khong bi gan [nofollow]'; | ||
| $txt['anti_spam_links_zero_disable'] = '[Loai tru lien ket noi bo: ' . $boardurl . ']<br>(Nhap 0 de tat)'; | ||
| $txt['anti_spam_links_guests'] = 'Khach...'; | ||
| $txt['anti_spam_links_guests_opt0'] = '(tat mod cho khach)'; | ||
| $txt['anti_spam_links_guests_opt1'] = 'khong duoc dang lien ket'; | ||
| $txt['anti_spam_links_guests_opt2'] = 'lien ket hien [nonactive]'; | ||
| $txt['anti_spam_links_guests_opt3'] = 'lien ket duoc gan [nofollow]'; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| <?php | ||
| /** | ||
| * Installer for Anti-Spam Links for SMF 2.1.x. | ||
| */ | ||
|
|
||
| global $boarddir, $sourcedir, $modSettings, $cacheAPI; | ||
|
|
||
| $manual = false; | ||
|
|
||
| if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) | ||
| { | ||
| require_once dirname(__FILE__) . '/SSI.php'; | ||
| $manual = true; | ||
| } | ||
| elseif (!defined('SMF')) | ||
| die('This installer must be run from within SMF.'); | ||
|
|
||
| if ($manual && !function_exists('add_integration_function')) | ||
| require_once $sourcedir . '/Subs.php'; | ||
|
|
||
| $package_files = array( | ||
| array( | ||
| 'source' => dirname(__FILE__) . '/SMF-2.1/Sources/AntiSpamLinks.php', | ||
| 'destination' => $sourcedir . '/AntiSpamLinks.php', | ||
| ), | ||
| array( | ||
| 'source' => dirname(__FILE__) . '/SMF-2.1/Themes/default/languages/AntiSpamLinks.english.php', | ||
| 'destination' => $boarddir . '/Themes/default/languages/AntiSpamLinks.english.php', | ||
| ), | ||
| array( | ||
| 'source' => dirname(__FILE__) . '/SMF-2.1/Themes/default/languages/AntiSpamLinks.vietnamese.php', | ||
| 'destination' => $boarddir . '/Themes/default/languages/AntiSpamLinks.vietnamese.php', | ||
| ), | ||
| ); | ||
|
|
||
| if ($manual) | ||
| { | ||
| foreach ($package_files as $file) | ||
| { | ||
| if (!file_exists($file['source'])) | ||
| continue; | ||
|
|
||
| @copy($file['source'], $file['destination']); | ||
| @chmod($file['destination'], 0644); | ||
| } | ||
|
|
||
| $hooks = array( | ||
| array('integrate_load_theme', 'AntiSpamLinks_LoadTheme'), | ||
| array('integrate_modify_post_settings', 'AntiSpamLinks_ModifyPostSettings'), | ||
| array('integrate_save_post_settings', 'AntiSpamLinks_SavePostSettings'), | ||
| array('integrate_post_errors', 'AntiSpamLinks_PostErrors'), | ||
| array('integrate_preview_post', 'AntiSpamLinks_PreviewPost'), | ||
| array('integrate_post_JavascriptModify', 'AntiSpamLinks_JavaScriptModify'), | ||
| array('integrate_jsmodify_xml', 'AntiSpamLinks_JavaScriptModifyXml'), | ||
| array('integrate_prepare_display_context', 'AntiSpamLinks_PrepareDisplayContext'), | ||
| array('integrate_getTopic_previous_post', 'AntiSpamLinks_PreviousPost'), | ||
| array('integrate_member_context', 'AntiSpamLinks_MemberContext'), | ||
| ); | ||
|
|
||
| foreach ($hooks as $hook) | ||
| add_integration_function($hook[0], $hook[1], true, '$sourcedir/AntiSpamLinks.php'); | ||
| } | ||
|
|
||
| $defaults = array( | ||
| 'anti_spam_links_nolinks' => 0, | ||
| 'anti_spam_links_newbielinks' => 0, | ||
| 'anti_spam_links_nofollowlinks' => 0, | ||
| 'anti_spam_links_guests' => 0, | ||
| ); | ||
|
|
||
| $to_update = array(); | ||
| foreach ($defaults as $setting => $value) | ||
| { | ||
| if (!isset($modSettings[$setting])) | ||
| $to_update[$setting] = $value; | ||
| } | ||
|
|
||
| if (!empty($to_update)) | ||
| updateSettings($to_update); | ||
|
|
||
| if (isset($cacheAPI) && is_object($cacheAPI) && is_callable(array($cacheAPI, 'cleanCache'))) | ||
| $cacheAPI->cleanCache(); | ||
|
|
||
| if ($manual) | ||
| { | ||
| header('Content-Type: text/plain; charset=UTF-8'); | ||
| echo "Anti-Spam Links for SMF 2.1.x installed.\n"; | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,20 @@ | ||
| Copyright (c) 2018, Simple Machines | ||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are met: | ||
| * Redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above copyright | ||
| notice, this list of conditions and the following disclaimer in the | ||
| documentation and/or other materials provided with the distribution. | ||
| * Neither the name of the <organization> nor the | ||
| names of its contributors may be used to endorse or promote products | ||
| derived from this software without specific prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | ||
| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| BSD 3-Clause License | ||
|
|
||
| Acknowledgements | ||
|
|
||
| This package is based on the original Anti-Spam Links modification for SMF: | ||
| https://custom.simplemachines.org/mods/index.php?mod=2404 | ||
|
|
||
| SMF 2.1.x port and rewrite by: | ||
| Thanh Nguyen (hoidulich.com) | ||
|
|
||
| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
|
||
| 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
|
||
| 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
|
||
| 3. Neither the name of Thanh Nguyen nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES ARE DISCLAIMED. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change the license?