Terms Infusion (Dictionary/Glossary) v1.00 (beta_26092006)
PHP-Fusion: v6.01.6
original author: muscapaul
email: muscapaul@gmail.com)
web: www.muscapaul.com
date: 06 October 2006
--------------------------------------------------
Copyright: Released under the terms and conditions
of the GNU General Public License (Version 2)
--------------------------------------------------


INTRODUCTION
------------

This document describe the procedure on how to add the use of [glos] [/glos] tags to your site. Using the tags will enable you to make links of terms (single words or specific phrases) that will lead to a page where the term is explained.
The file that MUST be modified to use the tags in the forum is ../maincore.php, since that file is responsible for parsing of bbcode. The tags can be added manually by typing them in, but the scripts can be modified to add buttons to the relevant pages.
Since it is complex to add links to Glossary pages in Articles, Custom Pages and News, it is recommended to modify the relevant admin pages (../administration/articles.php, ../administration/custom_pages.php and ../administration/news.php).

AUTOMATIC INSTALLATION
----------------------

Automatic installation is possible by uploading the contents of the changed_files folder to your server. You should only do this AFTER you made a backup of the following files and ascertained that no modifications were made to them already:
../maincore.php
../administration/articles.php
../administration/custom_pages.php
../administration/news.php
../forum/postedit.php
../forum/postreply.php
../forum/postnewthread.php
../forum/viewthread.php


MODIFYING MAINCORE.PHP TO PARSE GLOS TAGS
-----------------------------------------

1. Make a backup of the following file:
../maincore.php

2. Open the file ../maincore.php in a text editor of your choice and find on approx. line 344:

$text = preg_replace('#\[url=([\r\n]*)([^\s\'\";\+]*?)\](.*?)([\r\n]*)\[/url\]#si', '<a href=\'http://\2\' target=\'_blank\'>\3</a>', $text);

Immediately after add the following code:

	$text = preg_replace('#\[glos\]([\r\n]*)([^\'\";:\+]*?)([\r\n]*)\[/glos\]#si', '<a href=\''.INFUSIONS.'terms/terms.php?op=glos&term=\2\3\'>\2\3<img src=\''.INFUSIONS.'terms/images/help.gif\' border=\'0\'></a>', $text);

Save the file and close it.


ADDING A GLOS TAGS BUTTON TO THE FORUM
--------------------------------------

1. Make a backup of the following four files:
../forum/postedit.php
../forum/postreply.php
../forum/postnewthread.php
../forum/viewthread.php

2. Open the file ../forum/postedit.php in a text editor of your choice and find on approx.lines 192:

<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('message', '[quote]', '[/quote]');\">

Immediately after add the following code:

<input type='button' value='glos' class='button' style='width:45px;' onClick=\"addText('message', '[glos]', '[/glos]');\">

Save the file and close it.

3. Open the file ../forum/postnewthread.php in a text editor of your choice and find on approx.lines 161:

<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('message', '[quote]', '[/quote]');\">

Immediately after add the following code:

<input type='button' value='glos' class='button' style='width:45px;' onClick=\"addText('message', '[glos]', '[/glos]');\">

Save the file and close it.

4. Open the file ../forum/postreply.php in a text editor of your choice and find on approx.lines 181:

<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('message', '[quote]', '[/quote]');\">

Immediately after add the following code:

<input type='button' value='glos' class='button' style='width:45px;' onClick=\"addText('message', '[glos]', '[/glos]');\">

Save the file and close it.

5. Open the file ../forum/viewthread.php in a text editor of your choice and find on approx.lines 304:

<<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('message', '[quote]', '[/quote]');\"></td>


Replace this code with the following code:

<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('message', '[quote]', '[/quote]');\">
<input type='button' value='glos' class='button' style='width:45px;' onClick=\"addText('message', '[glos]', '[/glos]');\"></td>

Save the file and close it.


ADDING A GLOS TAGS BUTTON TO ARTICLES ADMIN PAGE
------------------------------------------------

This will add a link to the article that will search the database for the term eclosed between the tags.
The link will have the following structure:

<a href='http://www.diptera.info/infusions/terms/terms.php?op=glos&term=[*]'>[Glossary term]<img src='http://www.diptera.info/infusions/terms/images/help.gif' border='0'></a>

If no text is selected in the text box, you will have to replace [*] with the term required term. [Glossary] should also be replaced by the required term, but it gives you the option to fill in somrthing similar, too. In both cases spaces ar allowed.

Please note that the links are absolute. As soon as the domain name under which the site is hosted is changed, the link will point to the Glossary on the old domain. 

1. Make a backup of the following file:
../administration/articles.php

2. Open the file ../administration/articles.php in a text editor of your choice and find on approx. line 165:

<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('body', '<span class=\'alt\'>', '</span>');\"><br>

Replace this code with the following code:

<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('body', '<span class=\'alt\'>', '</span>');\">";
$settings = dbarray(dbquery("SELECT * FROM ".$db_prefix."settings"));
echo " <input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('body', '<a href=\'".$settings['siteurl']."infusions/terms/terms.php?op=glos&term=', '\'>\[Glossary term\]<img src=\'".$settings['siteurl']."infusions/terms/images/help.gif\' border=\'0\'></a>');\"><br>

3. In the same file find on approx.line 204:

<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('body2', '<span class=\'alt\'>', '</span>');\">

Replace this code with the following code:

<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('body2', '<span class=\'alt\'>', '</span>');\">";
$settings = dbarray(dbquery("SELECT * FROM ".$db_prefix."settings"));
echo " <input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('body2', '<a href=\'".$settings['siteurl']."infusions/terms/terms.php?op=glos&term=', '\'>\[Glossary term\]<img src=\'".$settings['siteurl']."infusions/terms/images/help.gif\' border=\'0\'></a>');\">

Save the file and close it.


ADDING A GLOS TAGS BUTTON TO CUSTOM PAGES ADMIN PAGE
----------------------------------------------------

This will add a link to the article that will search the database for the term eclosed between the tags.
The link will have the following structure:

<a href='http://www.diptera.info/infusions/terms/terms.php?op=glos&term=[*]'>[Glossary term]<img src='http://www.diptera.info/infusions/terms/images/help.gif' border='0'></a>

If no text is selected in the text box, you will have to replace [*] with the term required term. [Glossary] should also be replaced by the required term, but it gives you the option to fill in somrthing similar, too. In both cases spaces ar allowed.

Please note that the links are absolute. As soon as the domain name under which the site is hosted is changed, the link will point to the Glossary on the old domain. 

1. Make a backup of the following file:
../administration/custom_pages.php

2. Open the file ../administration/custom_pages.php in a text editor of your choice and find on approx. line 154:

<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('page_content', '<span class=\'alt\'>', '</span>');\">

Replace this code with the following code:

<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('page_content', '<span class=\'alt\'>', '</span>');\">";
$settings = dbarray(dbquery("SELECT * FROM ".$db_prefix."settings"));
echo " <input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('page_content', '<a href=\'".$settings['siteurl']."infusions/terms/terms.php?op=glos&term=', '\'>\[Glossary term\]<img src=\'".$settings['siteurl']."infusions/terms/images/help.gif\' border=\'0\'></a>');\">

Save the file and close it.


ADDING A GLOS TAGS BUTTON TO NEWS ADMIN PAGE
--------------------------------------------

This will add a link to the article that will search the database for the term eclosed between the tags.
The link will have the following structure:

<a href='http://www.diptera.info/infusions/terms/terms.php?op=glos&term=[*]'>[Glossary term]<img src='http://www.diptera.info/infusions/terms/images/help.gif' border='0'></a>

If no text is selected in the text box, you will have to replace [*] with the term required term. [Glossary] should also be replaced by the required term, but it gives you the option to fill in somrthing similar, too. In both cases spaces ar allowed.

Please note that the links are absolute. As soon as the domain name under which the site is hosted is changed, the link will point to the Glossary on the old domain. 

1. Make a backup of the following file:
../administration/news.php

2. Open the file ../administration/news.php in a text editor of your choice and find on approx. line 210:

<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('body', '<span class=\'alt\'>', '</span>');\"><br>

Replace this code with the following code:

<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('body', '<span class=\'alt\'>', '</span>');\">";
$settings = dbarray(dbquery("SELECT * FROM ".$db_prefix."settings"));
echo " <input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('body', '<a href=\'".$settings['siteurl']."infusions/terms/terms.php?op=glos&term=', '\'>\[Glossary term\]<img src=\'".$settings['siteurl']."infusions/terms/images/help.gif\' border=\'0\'></a>');\"><br>

3. In the same file find on approx.line 250:

<input type='button' value='alt' class='button' style='width:25px' onClick=\"addText('body2', '<span class=\'alt\'>', '</span>');\"><br>

Replace this code with the following code:

<input type='button' value='alt' class='button' style='width:25px' onClick=\"addText('body2', '<span class=\'alt\'>', '</span>');\">";
$settings = dbarray(dbquery("SELECT * FROM ".$db_prefix."settings"));
echo " <input type='button' value='glos' class='button' style='width:35px;' onClick=\"addText('body2', '<a href=\'".$settings['siteurl']."infusions/terms/terms.php?op=glos&term=', '\'>\[Glossary term\]<img src=\'".$settings['siteurl']."infusions/terms/images/help.gif\' border=\'0\'></a>');\"><br>

Save the file and close it.


