Skip to content

Commit a206b98

Browse files
committed
Add GPL 3 licence and README.md; make some rewordings
1 parent 1a62ee5 commit a206b98

File tree

6 files changed

+833
-4
lines changed

6 files changed

+833
-4
lines changed

LICENCE

+674
Large diffs are not rendered by default.

README.md

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
## About Link Tools
2+
3+
Link Tools is a plugin for [MyBB](https://mybb.com/) 1.8. It extracts the links (URLs) in posts made to your forum and then provides you with two new features:
4+
5+
1. *Seamless link searching*. Just type a link (URL) into the default field ("Keyword") of the standard MyBB search form and Link Tools will intercept the search, and provide accurate results: only posts which contain the link or its equivalent will be listed. The default MyBB search does not handle links at all well and typically returns results completely unrelated to the link for which you searched.
6+
7+
2. *A duplicate link warner*. When a member is starting a new thread, s/he will be warned if any links (URLs) that s/he includes in the thread-starter have already been posted to the board. This feature is especially useful when your board is heavily resource-based and there is a risk of members starting duplicate discussions about resources (links and videos) that have already been discussed.
8+
9+
### What does Link Tools consider to be a link?
10+
11+
Anything that MyBB core also considers to be a link:
12+
13+
1. The URLs in [url] tags.
14+
15+
2. The URLs in [video] tags.
16+
17+
3. Bare URLs: those beginning with `http://`, `https://`, `ftp://`, `ftp.`, and `www.`.
18+
19+
### How does Link Tools determine whether one link matches another?
20+
21+
Link Tools handles all of the different ways in which two links can look different but be the same (resolve to the same page):
22+
23+
1. When they are the same except for their protocol: `http://` versus `https://`.
24+
25+
2. When one has a `www.` prefix and the other does not.
26+
27+
3. When they have the same query parameters but in a different order.
28+
29+
4. When one has a redundant query parameter - e.g., the `fbclid` query parameter added by Facebook - and the other does not.
30+
31+
5. When their domains are capitalised differently.
32+
33+
6. When one redirects (potentially via multiple redirects) to the other, e.g., when a URL shortening service like https://bitly.com/ is used to create a short URL which redirects to the target URL.
34+
35+
7. When both redirect (potentially via multiple redirects) to the same final link, e.g., when two different "shortened" URLs redirect to the same target URL.
36+
37+
Note that the redirects recognised by Link Tools are: HTTP redirects, HTML meta tag redirects, and "canonical" HTML link tags.
38+
39+
The first five differences are eliminated via "normalisation" of URLs.
40+
41+
The final two are eliminated by querying the URLs until the terminating URL is found. This is done using the cURL PHP functions.
42+
43+
## Customisation #1: adding to the ignored query parameters
44+
45+
As indicated above, Link Tools ignores (removes from links during normalisation) the redundant query parameters that it knows about when determining the equivalence of two links. You can find those query parameters in the file `inc/plugins/linktools/ignored-query-params.php`.
46+
47+
But what if you want to add more? Simply follow the instructions in the comments at the top of that file (look for the all-caps beginning "DO NOT MODIFY THIS FILE").
48+
49+
## Customisation #2: adding to the auto-terminating link types
50+
51+
The terminating links of some types of link can be determined automatically without querying those links, e.g., youtu.be links reliably terminate in www.youtube.com video links. Link Tools ships with a list of rules to this effect, which minimise queries for some common links. You can find these rules (regular expressions and their replacements) in the file `inc/plugins/linktools/auto-term-links.php`.
52+
53+
As for ignored query parameters, if you want to add more rules, then simply follow the instructions in the comments at the top of that file (again, look for the all-caps beginning "DO NOT MODIFY THIS FILE").
54+
55+
## Requirements
56+
57+
* [The Client URL Library (cURL) for PHP](https://www.php.net/manual/en/book.curl.php).
58+
59+
## Licence
60+
61+
Link Tools is licensed under the GPL 3.
62+
63+
## Installing
64+
65+
1. *Download*.
66+
67+
Download an archive of the plugin's files.
68+
69+
2. *Copy files*.
70+
71+
Extract the files in that archive to a temporary location, and then copy the files in "root" into the root of your MyBB installation. That is to say that "root/linktools.php" should be copied to your MyBB root directory, "root/inc/languages/english/linktools.lang.php" should be copied to your MyBB root's "inc/languages/english/" directory, etc.
72+
73+
3. *Install via the ACP*.
74+
75+
In a web browser, open the "Plugins" module in the ACP of your MyBB installation. You should see "Link Tools" under "Inactive Plugins". Click "Install & Activate" next to it. You should then see the plugin listed under "Active Plugins" on the reloaded page.
76+
77+
4. *Extract links from existing posts, if any*.
78+
79+
In the plugin's listing, if your board contains any posts, you will see a warning prompt to run link extraction on those posts. Click the "here" button (styled as a plain text link) to do this.
80+
81+
5. *Resolve terminating redirects for extracted links, if any*.
82+
83+
Return to the plugin's listing, and if any links were extracted in the last step, you will see a warning prompt to run terminating link resolution on them. Again, click the "here" button (again, styled as a plain text link) to do this.
84+
85+
Optionally, you may then want to configure settings (by navigating in the ACP to "Settings" -> "Plugin Settings" -> "Link Tools Settings"), and/or edit the plugin's templates and/or its stylesheet.
86+
87+
## Upgrading
88+
89+
1. *Deactivate*.
90+
91+
In a web browser, open the "Plugins" module in the ACP of your MyBB installation and click "Deactivate" beside the "Link Tools" plugin.
92+
93+
2. *Download and Copy files*.
94+
95+
As in steps one and two for installing above.
96+
97+
3. *Reactivate*.
98+
99+
As for step one but clicking "Activate" rather than "Deactivate".
100+
101+
This will maintain any settings and template changes that you've made, although if you've made template changes, you may after upgrading need to navigate in the ACP to "Templates & Style" -> "Templates" -> "Find Updated Templates" to properly integrate/update this plugin's templates.

root/inc/plugins/linktools.php

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
<?php
22

3+
/**
4+
* Part of the Link Tools plugin for MyBB 1.8.
5+
* Copyright (C) 2020 Laird Shaw
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
321
// Disallow direct access to this file for security reasons.
422
if (!defined('IN_MYBB')) {
523
die('Direct access to this file is not allowed.');

root/inc/plugins/linktools/ignored-query-params.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* For purposes of correctly determining links which are identical to
4+
* For purposes of correctly determining which links are identical to
55
* one another, Link Tools "normalises" each link (URL). Part of the
66
* normalisation process is the alphabetical sorting of any query
77
* parameters.
@@ -11,13 +11,13 @@
1111
* parameter is that added by Facebook to outgoing links:
1212
* fbclid=[token].
1313
* Whether or not this parameter is present, and no matter its value,
14-
* the same page is shown. Thus all variants of the URL with and
14+
* the same page is shown. Thus, all variants of the URL with and
1515
* without this query should be treated as equal, which is ensured by
1616
* this aspect of Link Tools' link (URL) "normalisation" process.
1717
*
1818
* The purpose of this file is to specify those parameters which should
19-
* be ignored during normalisation. See further below for customisation
20-
* instructions.
19+
* be ignored (removed from links) as part of normalisation.
20+
* See further below for customisation instructions.
2121
*
2222
* Supported array entry formats:
2323
*

root/linktools.php

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
<?php
22

3+
/**
4+
* Part of the Link Tools plugin for MyBB 1.8.
5+
* Copyright (C) 2020 Laird Shaw
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
321
define("IN_MYBB", 1);
422
require_once "./global.php";
523

root/lkt_search.php

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
<?php
22

3+
/**
4+
* Part of the Link Tools plugin for MyBB 1.8.
5+
* Copyright (C) 2020 Laird Shaw
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
321
define('IN_MYBB', 1);
422
define('IGNORE_CLEAN_VARS', 'sid');
523
define('THIS_SCRIPT', 'lkt_search.php');

0 commit comments

Comments
 (0)