Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
532 changes: 532 additions & 0 deletions anti-spam-links/SMF-2.1/Sources/AntiSpamLinks.php

Large diffs are not rendered by default.

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]';

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]';

89 changes: 89 additions & 0 deletions anti-spam-links/install.php
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";
}

44 changes: 20 additions & 24 deletions anti-spam-links/license.txt
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.

Loading