1. .flv conversion to use flowplayer must come after url conversion in makeClickable()
authorCindy Li <cli@ocad.ca>
Tue, 24 Aug 2010 20:24:55 +0000 (20:24 -0000)
committerCindy Li <cli@ocad.ca>
Tue, 24 Aug 2010 20:24:55 +0000 (20:24 -0000)
2. clean up output.inc.php to remove the functions that are not in use

docs/home/classes/ContentUtility.class.php
docs/home/ims/include/ims_template.inc.php
docs/home/imscc/include/ims_template.inc.php
docs/include/lib/output.inc.php

index ef16db6..2c3efbb 100644 (file)
@@ -209,6 +209,10 @@ class ContentUtility {
                        return $text;\r
                }\r
        \r
+               // remove the spaces in [media] tag, otherwise, the next line converts URL inside [media] into <a> tag\r
+               $text = preg_replace("/(\[media\])([\s]*)(.*)(\[\/media\])/", '$1$3$4', $text);\r
+               $text = preg_replace("/(\[media\])(.*)([\s]*)(\[\/media\])/U", '$1$2$4', $text);\r
+               \r
                $media_matches = Array();\r
                \r
                /*\r
@@ -289,32 +293,35 @@ class ContentUtility {
                        }\r
                }\r
                \r
-               $text = ContentUtility::embedFLV($text);\r
-               \r
                return $text;\r
        }\r
 \r
-       private static function makeClickable($text) {\r
+       public static function makeClickable($text) {\r
                $text = ContentUtility::embedMedia($text);\r
        \r
-       //      $text = eregi_replace("([[:space:]])(http[s]?)://([^[:space:]<]*)([[:alnum:]#?/&=])", "\\1<a href=\"\\2://\\3\\4\">\\3\\4</a>", $text);\r
-       //\r
-       //      $text = eregi_replace(  '([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.\r
-       //                                                      '\@'.'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+)',\r
-       //                                                      "<a href=\"mailto:\\1\">\\1</a>",\r
-       //                                                      $text);\r
-       \r
-               $text = preg_replace("/([\s])(http[s]?):\/\/(.*)(\s|\$|<br\s\/\>)(.*)/U", \r
-                                    "\\1<a href=\"\\2://\\3\">\\3</a>\\4\\5", $text);\r
-               \r
-               $text = preg_replace('/([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.\r
-                                                       '\@'.'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+)/i',\r
-                                                       "<a href=\"mailto:\\1\">\\1</a>",\r
+               // convert plain text URL to clickable URL.\r
+               // Limited conversion: It doesn't cover the case when the stuff in front of the URL is not a word. For example:\r
+               // <p>http://google.ca</p>\r
+               // "http://google.ca" \r
+               $text = preg_replace('/(^|[\n ])([\w]*?[\"]*)((?<!(\[media\]))http(s)?:\/\/[\w]+[^ \,\"\n\r\t\)<]*)/is', \r
+                                    '$1$2<a href="$3">$3</a>', $text);\r
+               \r
+               // convert email address to clickable URL that pops up "send email" interface with the address filled in\r
+               $text = preg_replace('/(?|<a href="mailto[\s]*:[\s]*([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'\@'\r
+                                   .'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+)">(.*)<\/a>'\r
+                                   .'|((((([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'\@'\r
+                                   .'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+))))))/i',\r
+                                                       "<a href=\"mailto:\\1\">\\5</a>",\r
                                                        $text);\r
+               \r
+               // flv conversion needs to come after url conversion (2 lines above) otherwise the url to flowplayer swf file\r
+               // in the script for a.flowplayerholder is converted\r
+               $text = ContentUtility::embedFLV($text);\r
+               \r
                return $text;\r
        }\r
 \r
-       private static function myCodes($text, $html = false) {\r
+       public static function myCodes($text, $html = false) {\r
                global $_base_path;\r
                global $HTTP_USER_AGENT;\r
        \r
@@ -400,7 +407,7 @@ class ContentUtility {
                $text = str_replace("[code]","[code]<?php",$text);\r
                $text = str_replace("[/code]","?>[/code]",$text);\r
        \r
-               $text = preg_replace("/\[code\]\s*(.*)\s*\[\\/code\]/Usei", "highlight_code(fix_quotes('\\1'), $html)", $text);\r
+               $text = preg_replace("/\[code\]\s*(.*)\s*\[\\/code\]/Usei", "ContentUtility::highlightCode(ContentUtility::fixQuotes('\\1'), $html)", $text);\r
                // now remove the <?php added above and leave the syntax colour behind.\r
                $text = str_replace("&lt;?php", "", $text);\r
                $text = str_replace("?&gt;", "", $text);\r
@@ -408,7 +415,34 @@ class ContentUtility {
                return $text;\r
        }\r
 \r
-       private static function imageReplace($text) {\r
+       /* contributed by Thomas M. Duffey <tduffey at homeboyz.com> */\r
+       private static function highlightCode($code, $html) {\r
+               // XHTMLize PHP highlight_string output until it gets fixed in PHP\r
+               static $search = array(\r
+                       '<br>',\r
+                       '<font',\r
+                       '</font>',\r
+                       'color="');\r
+       \r
+               static $replace = array(\r
+                       '<br />',\r
+                       '<span',\r
+                       '</span>',\r
+                       'style="color:');\r
+               if (!$html) {\r
+                       $code = str_replace('&lt;', '<', $code);\r
+                       $code = str_replace("\r", '', $code);\r
+               }\r
+       \r
+               return str_replace($search, $replace, highlight_string($code, true));\r
+       }\r
+       \r
+       /* contributed by Thomas M. Duffey <tduffey at homeboyz.com> */\r
+       private static function fixQuotes($text){\r
+               return str_replace('\\"', '"', $text);\r
+       }\r
+\r
+       public static function imageReplace($text) {\r
                /* image urls do not require http:// */\r
                \r
        //      $text = eregi_replace("\[image(\|)?([[:alnum:][:space:]]*)\]" .\r
index 24a5639..c904ad5 100644 (file)
@@ -91,7 +91,6 @@ function print_organizations($parent_id,
                        $html_link = '<a href="resources/'.$content['content_path'].$content['content_id'].'.html" target="body">'.$content['title'].'</a>';    
                        
                        /* save the content as HTML files */
-                       /* @See: include/lib/format_content.inc.php */
                        $content['text'] = str_replace('CONTENT_DIR/', '', $content['text']);
 
                        /* Commented by Cindy Qi Li on Jan 12, 2010
index ad32171..3384bd3 100644 (file)
@@ -116,7 +116,6 @@ function print_organizations($parent_id,
                        $html_link = '<a href="resources/'.$content['content_path'].$content['content_id'].'.html" target="body">'.$content['title'].'</a>';
                        
                        /* save the content as HTML files */
-                       /* @See: include/lib/format_content.inc.php */
                        $content['text'] = str_replace('CONTENT_DIR/', '', $content['text']);
                        /* Commented by Cindy Qi Li on Jan 12, 2010
                         * AContent does not support glossary
index 6aa0d81..f09a0bf 100644 (file)
@@ -11,7 +11,8 @@
 /************************************************************************/
 
 if (!defined('TR_INCLUDE_PATH')) { exit; }
-require(TR_INCLUDE_PATH . 'classes/DAO/LanguageTextDAO.class.php');
+require_once(TR_INCLUDE_PATH . 'classes/DAO/LanguageTextDAO.class.php');
+require_once(TR_INCLUDE_PATH . '../home/classes/ContentUtility.class.php');
 
 /**********************************************************************************/
 /* Output functions found in this file, in order:
@@ -359,15 +360,15 @@ function AT_date($format='%Y-%M-%d', $timestamp = '', $format_type=TR_DATE_MYSQL
                }
 
                if (query_bit($_field_formatting[$name], TR_FORMTR_ATCODES)) {
-                       $input = trim(myCodes(' ' . $input . ' '));
+                       $input = trim(ContentUtility::myCodes(' ' . $input . ' '));
                }
 
                if (query_bit($_field_formatting[$name], TR_FORMTR_LINKS)) {
-                       $input = trim(make_clickable(' ' . $input . ' '));
+                       $input = trim(ContentUtility::makeClickable(' ' . $input . ' '));
                }
 
                if (query_bit($_field_formatting[$name], TR_FORMTR_IMAGES)) {
-                       $input = trim(image_replace(' ' . $input . ' '));
+                       $input = trim(ContentUtility::imageReplace(' ' . $input . ' '));
                }
 
        
@@ -452,435 +453,6 @@ function smile_replace($text) {
        return $text;
 }
 
-
-/* Used specifically for the visual editor
-*/
-function smile_javascript () {
-       global $_base_path;
-       global $smile_pics;
-       global $smile_codes;
-
-       static $i = 0;
-
-       while ($smile_pics [$i]) {
-               echo 'case "'.$smile_codes[$i].'":'."\n";
-               echo 'pic = "'.$smile_pics[$i].'";'."\n";
-               echo 'break;'."\n";
-               $i++;
-       }
-}
-
-function myCodes($text, $html = false) {
-       global $_base_path;
-       global $HTTP_USER_AGENT;
-
-       if (substr($HTTP_USER_AGENT,0,11) == 'Mozilla/4.7') {
-               $text = str_replace('[quote]','</p><p class="block">',$text);
-               $text = str_replace('[/quote]','</p><p>',$text);
-
-               $text = str_replace('[reply]','</p><p class="block">',$text);
-               $text = str_replace('[/reply]','</p><p>',$text);
-       } else {
-               $text = str_replace('[quote]','<blockquote>',$text);
-               $text = str_replace('[/quote]','</blockquote><p>',$text);
-
-               $text = str_replace('[reply]','</p><blockquote class="block"><p>',$text);
-               $text = str_replace('[/reply]','</p></blockquote><p>',$text);
-       }
-
-       $text = str_replace('[b]','<strong>',$text);
-       $text = str_replace('[/b]','</strong>',$text);
-
-       $text = str_replace('[i]','<em>',$text);
-       $text = str_replace('[/i]','</em>',$text);
-
-       $text = str_replace('[u]','<u>',$text);
-       $text = str_replace('[/u]','</u>',$text);
-
-       $text = str_replace('[center]','<center>',$text);
-       $text = str_replace('[/center]','</center><p>',$text);
-
-       /* colours */
-       $text = str_replace('[blue]','<span style="color: blue;">',$text);
-       $text = str_replace('[/blue]','</span>',$text);
-
-       $text = str_replace('[orange]','<span style="color: orange;">',$text);
-       $text = str_replace('[/orange]','</span>',$text);
-
-       $text = str_replace('[red]','<span style="color: red;">',$text);
-       $text = str_replace('[/red]','</span>',$text);
-
-       $text = str_replace('[purple]','<span style="color: purple;">',$text);
-       $text = str_replace('[/purple]','</span>',$text);
-
-       $text = str_replace('[green]','<span style="color: green;">',$text);
-       $text = str_replace('[/green]','</span>',$text);
-
-       $text = str_replace('[gray]','<span style="color: gray;">',$text);
-       $text = str_replace('[/gray]','</span>',$text);
-
-       $text = str_replace('[op]','<span class="bigspacer"></span> <a href="',$text);
-       $text = str_replace('[/op]','">'._AT('view_entire_post').'</a>',$text);
-
-       $text = str_replace('[head1]','<h2>',$text);
-       $text = str_replace('[/head1]','</h2>',$text);
-
-       $text = str_replace('[head2]','<h3>',$text);
-       $text = str_replace('[/head2]','</h3>',$text);
-
-       $text = str_replace('[cid]',$_base_path.'content.php?cid='.$_SESSION['s_cid'],$text);
-
-       global $sequence_links;
-       if (isset($sequence_links['previous']) && $sequence_links['previous']['url']) {
-               $text = str_replace('[pid]', $sequence_links['previous']['url'], $text);
-       }
-       if (isset($sequence_links['next']) && $sequence_links['next']['url']) {
-               $text = str_replace('[nid]', $sequence_links['next']['url'], $text);
-       }
-       if (isset($sequence_links['resume']) && $sequence_links['resume']['url']) {
-               $text = str_replace('[nid]', $sequence_links['resume']['url'], $text);
-       }
-       if (isset($sequence_links['first']) && $sequence_links['first']['url']) {
-               $text = str_replace('[fid]', $sequence_links['first']['url'], $text);
-       }
-
-       /* contributed by Thomas M. Duffey <tduffey at homeboyz.com> */
-       $html = !$html ? 0 : 1;
-       $text = preg_replace("/\[code\]\s*(.*)\s*\[\\/code\]/Usei", "highlight_code(fix_quotes('\\1'), $html)", $text);
-
-       return $text;
-}
-
-/* contributed by Thomas M. Duffey <tduffey at homeboyz.com> */
-function highlight_code($code, $html) {
-       // XHTMLize PHP highlight_string output until it gets fixed in PHP
-       static $search = array(
-               '<br>',
-               '<font',
-               '</font>',
-               'color="');
-
-       static $replace = array(
-               '<br />',
-               '<span',
-               '</span>',
-               'style="color:');
-       if (!$html) {
-               $code = str_replace('&lt;', '<', $code);
-               $code = str_replace("\r", '', $code);
-       }
-
-       return str_replace($search, $replace, highlight_string($code, true));
-}
-
-/* contributed by Thomas M. Duffey <tduffey at homeboyz.com> */
-function fix_quotes($text){
-       return str_replace('\\"', '"', $text);
-}
-
-function embed_media($text) {
-       if (preg_match("/\[media(\|[0-9]+\|[0-9]+)?\]*/", $text)==0){
-               return $text;
-       }
-
-       $media_matches = Array();
-       
-       /*
-               First, we search though the text for all different kinds of media defined by media tags and store the results in $media_matches.
-               
-               Then the different replacements for the different media tags are stored in $media_replace.
-               
-               Lastly, we loop through all $media_matches / $media_replaces. (We choose $media_replace as index because $media_matches is multi-dimensioned.) It is important that for each $media_matches there is a $media_replace with the same index. For each media match we check the width/height, or we use the default value of 425x350. We then replace the height/width/media1/media2 parameter placeholders in $media_replace with the correct ones, before running a str_replace on $text, replacing the given media with its correct replacement.
-               
-       */
-       
-       // youtube videos
-       preg_match_all("#\[media[0-9a-z\|]*\]http://([a-z0-9\.]*)?youtube.com/watch\?v=([a-z0-9_-]+)\[/media\]#i",$text,$media_matches[1],PREG_SET_ORDER);
-       $media_replace[1] = '<object width="##WIDTH##" height="##HEIGHT##"><param name="movie" value="http://##MEDIA1##youtube.com/v/##MEDIA2##"></param><embed src="http://##MEDIA1##youtube.com/v/##MEDIA2##" type="application/x-shockwave-flash" width="##WIDTH##" height="##HEIGHT##"></embed></object>';
-               
-       // .mpg
-       preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).mpg\[/media\]#i",$text,$media_matches[2],PREG_SET_ORDER);
-       $media_replace[2] = "<object data=\"##MEDIA1##.mpg\" type=\"video/mpeg\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.mpg\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.mpg\">##MEDIA1##.mpg</a></object>";
-       
-       // .avi
-       preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).avi\[/media\]#i",$text,$media_matches[3],PREG_SET_ORDER);
-       $media_replace[3] = "<object data=\"##MEDIA1##.avi\" type=\"video/x-msvideo\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.avi\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.avi\">##MEDIA1##.avi</a></object>";
-       
-       // .wmv
-       preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).wmv\[/media\]#i",$text,$media_matches[4],PREG_SET_ORDER);
-       $media_replace[4] = "<object data=\"##MEDIA1##.wmv\" type=\"video/x-ms-wmv\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.wmv\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.wmv\">##MEDIA1##.wmv</a></object>";
-       
-       // .mov
-       preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).mov\[/media\]#i",$text,$media_matches[5],PREG_SET_ORDER);
-       $media_replace[5] = "<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.mov\"><param name=\"controller\" value=\"true\"><param name=\"autoplay\" value=\"false\"><!--[if gte IE 7]> <!--><object type=\"video/quicktime\" data=\"##MEDIA1##.mov\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"controller\" value=\"true\"><param name=\"autoplay\" value=\"false\"><a href=\"##MEDIA1##.mov\">##MEDIA1##.mov</a></object><!--<![endif]--><!--[if lt IE 7]><a href=\"##MEDIA1##.mov\">##MEDIA1##.mov</a><![endif]--></object>";
-       
-       // .swf
-       preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).swf\[/media\]#i",$text,$media_matches[6],PREG_SET_ORDER);
-       $media_replace[6] = "<object type=\"application/x-shockwave-flash\" data=\"##MEDIA1##.swf\" width=\"##WIDTH##\" height=\"##HEIGHT##\">  <param name=\"movie\" value=\"##MEDIA1##.swf\"><param name=\"loop\" value=\"false\"><a href=\"##MEDIA1##.swf\">##MEDIA1##.swf</a></object>";
-       
-       // .mp3
-       preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+).mp3\[/media\]#i",$text,$media_matches[7],PREG_SET_ORDER);
-       $media_replace[7] = "<object type=\"audio/mpeg\" data=\"##MEDIA1##.mp3\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.mp3\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.mp3\">##MEDIA1##.mp3</a></object>";
-       
-       // .wav
-       preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+).wav\[/media\]#i",$text,$media_matches[8],PREG_SET_ORDER);
-       $media_replace[8] ="<object type=\"audio/x-wav\" data=\"##MEDIA1##.wav\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.wav\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.wav\">##MEDIA1##.wav</a></object>";
-       
-       // .ogg
-       preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+).ogg\[/media\]#i",$text,$media_matches[9],PREG_SET_ORDER);
-       $media_replace[9] ="<object type=\"application/ogg\" data=\"##MEDIA1##.ogg\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.ogg\"><a href=\"##MEDIA1##.ogg\">##MEDIA1##.ogg</a></object>";
-       
-       // .mid
-       preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+).mid\[/media\]#i",$text,$media_matches[10],PREG_SET_ORDER);
-       $media_replace[10] ="<object type=\"application/x-midi\" data=\"##MEDIA1##.mid\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.mid\"><a href=\"##MEDIA1##.mid\">##MEDIA1##.mid</a></object>";
-       
-       $text = preg_replace("#\[media[0-9a-z\|]*\](.+[^\s\"]+).mid\[/media\]#i", "<object type=\"application/x-midi\" data=\"\\1.mid\" width=\"".$width."\" height=\"".$height."\"><param name=\"src\" value=\"\\1.mid\"><a href=\"\\1.mid\">\\1.mid</a></object>", $text);
-
-       // Executing the replace
-       for ($i=1;$i<=count($media_replace);$i++){
-               foreach($media_matches[$i] as $media)
-               {
-                       
-                       //find width and height for each matched media
-                       if (preg_match("/\[media\|([0-9]*)\|([0-9]*)\]*/", $media[0], $matches)) 
-                       {
-                               $width = $matches[1];
-                               $height = $matches[2];
-                       }
-                       else
-                       {
-                               $width = 425;
-                               $height = 350;
-                       }
-                       
-                       //replace media tags with embedded media for each media tag
-                       $media_input = $media_replace[$i];
-                       $media_input = str_replace("##WIDTH##","$width",$media_input);
-                       $media_input = str_replace("##HEIGHT##","$height",$media_input);
-                       $media_input = str_replace("##MEDIA1##","$media[1]",$media_input);
-                       $media_input = str_replace("##MEDIA2##","$media[2]",$media_input);
-                       $text = str_replace($media[0],$media_input,$text);
-               }
-       }
-               
-       return $text;
-}
-
-function make_clickable($text) {
-       $text = embed_media($text);
-
-       // The next 3 preg_replace convert plain text URL to clickable URL.
-       // limited conversion. It doesn't cover the case when the stuff in front of the URL is not a word. For example:
-       // <p>http://google.ca</p>
-       // "http://google.ca"  
-       // 1. remove the spaces in [media] tag, otherwise, the next line converts URL inside [media] into <a> tag
-       $text = preg_replace("/(\[media\])([\s]*)(.*)(\[\/media\])/", '$1$3$4', $text);
-       $text = preg_replace("/(\[media\])(.*)([\s]*)(\[\/media\])/U", '$1$2$4', $text);
-       // 2. convert URL
-       $text = preg_replace('/(^|[\n ])([\w]*?[\"]*)((?<!(\[media\]))http(s)?:\/\/[\w]+[^ \,\"\n\r\t\)<]*)/is', 
-                            '$1$2<a href="$3">$3</a>', $text);
-       
-       // convert email address to clickable URL that pops up "send email" interface with the address filled in
-       $text = preg_replace('/(?|<a href="mailto[\s]*:[\s]*([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'\@'
-                            .'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+)">(.*)<\/a>'
-                            .'|((((([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'\@'
-                            .'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+))))))/i',
-                                               "<a href=\"mailto:\\1\">\\5</a>",
-                                               $text);
-       
-       return $text;
-}
-
-function image_replace($text) {
-       /* image urls do not require http:// */
-       
-       $text = preg_replace("/\[image(\|)?([a-zA-Z0-9\s]*)\]".
-                            "[\s]*".
-                            "([a-zA-Z0-9\#\?\/\&\=\:\\\"\'\_\.\-]+)[\s]*".
-                            "((\[\/image\])|(.*\[\/image\]))/i",
-                                 "<img src=\"\\3\" alt=\"\\2\" />",
-                                 $text);
-       
-       return $text;
-}
-
-function formTR_final_output($text, $nl2br = true) {
-       global $_base_path;
-
-       $text = str_replace('CONTENT_DIR/', '', $text);
-
-       if ($nl2br) {
-               return nl2br(image_replace(make_clickable(myCodes(' '.$text, false))));
-       }
-       return image_replace(make_clickable(myCodes(' '.$text, true)));
-}
-
-/****************************************************************************************/
-/* @See: ./user/search.php & ./index.php */
-function highlight($input, $var) {//$input is the string, $var is the text to be highlighted
-       if ($var != "") {
-               $xtemp = "";
-               $i=0;
-               /*
-                       The following 'if' statement is a check to ensure that the search term is not part of the tag, '<strong class="highlight">'.  Words within this string are avoided in case a previously highlighted string is used for the haystack, $input.  To avoid any html breaks in the highlighted string, the search word is avoided completely.
-               */
-               if (strpos('<strong class="highlight">', $var) !== false) {
-                       return $input;
-               }
-               while($i<strlen($input)){
-                       if((($i + strlen($var)) <= strlen($input)) && (strcasecmp($var, substr($input, $i, strlen($var))) == 0)) {
-                               $xtemp .= '<strong class="highlight">' . substr($input, $i , strlen($var)) . '</strong>';
-                               $i += strlen($var);
-                       }
-                       else {
-                               $xtemp .= $input{$i};
-                               $i++;
-                       }
-               }
-               $input = $xtemp;
-       }
-       return $input;
-}
-
-
-/* @See: ./index.php */
-function formTR_content($input, $html = 0, $glossary, $simple = false) {
-       global $_base_path, $_config_defaults;
-
-       if (!$html) {
-               $input = str_replace('<', '&lt;', $input);
-               $input = str_replace('&lt;?php', '<?php', $input); // for bug #2087
-       }
-
-       /* do the glossary search and replace: */
-       if (is_array($glossary)) {
-               foreach ($glossary as $k => $v) {
-                       $k = urldecode($k);
-                       $v = str_replace("\n", '<br />', $v);
-                       $v = str_replace("\r", '', $v);
-
-                       /* escape special characters */
-                       $k = preg_quote($k);
-
-                       $k = str_replace('&lt;', '<', $k);
-                       $k = str_replace('/', '\/', $k);
-
-                       $original_term = $k;
-                       $term = $original_term;
-
-                       $term = '(\s*'.$term.'\s*)';
-                       $term = str_replace(' ','((<br \/>)*\s*)', $term); 
-
-                       $def = htmlspecialchars($v);            
-                       if ($simple) {
-                               $input = preg_replace
-                                               ("/(\[\?\])$term(\[\/\?\])/i",
-                                               '<a href="'.$simple.'glossary.html#'.urlencode($original_term).'" target="body" class="at-term">\\2</a>',
-                                               $input);
-                       } else {
-                               $input = preg_replace
-                                               ("/(\[\?\])$term(\[\/\?\])/i",
-                                               '\\2<sup><a href="'.$_base_path.'glossary/index.php?g_cid='.$_SESSION['s_cid'].SEP.'w='.urlencode($original_term).'#term" onmouseover="return overlib(\''.$def.'\', CAPTION, \''.addslashes($original_term).'\', AUTOSTATUS);" onmouseout="return nd();" onfocus="return overlib(\''.$def.'\', CAPTION, \''.addslashes($original_term).'\', AUTOSTATUS);" onblur="return nd();"><span style="color: blue; text-decoration: none;font-size:small; font-weight:bolder;">?</span></a></sup>',
-                                               $input);
-                       }
-               }
-       } else if (!$user_glossary) {
-               $input = str_replace(array('[?]','[/?]'), '', $input);
-       }
-
-       $input = str_replace('CONTENT_DIR', '', $input);
-
-       if (isset($_config_defaults['latex_server']) && $_config_defaults['latex_server']) {
-               // see: http://www.forkosh.com/mimetex.html
-               $input = preg_replace('/\[tex\](.*?)\[\/tex\]/sie', "'<img src=\"'.\$_config_defaults['latex_server'].rawurlencode('$1').'\" align=\"middle\">'", $input);
-       }
-
-       if ($html) {
-               $x = formTR_final_output($input, false);
-               return $x;
-       }
-
-       $output = formTR_final_output($input);
-
-       $output = '<p>'.$output.'</p>';
-
-       return $output;
-}
-
-/***********************************************************************
-       @See /include/Classes/Message/Message.class.php
-       Jacek Materna
-*/
-
-/**
-* Take a code as input and grab its language specific message. Also cache the resulting 
-* message. Return the message. Same as get_message but key value in cache is string
-* @access  public
-* @param   string $codes       Message Code to translate - > 'term' field in DB
-* @return  string                      The translated language specific message for code $code
-* @author  Jacek Materna
-*/
-function getTranslatedCodeStr($codes) {
-       
-       /* this is where we want to get the msgs from the database inside a static variable */
-       global $_cache_msgs_new;
-       static $_msgs_new;
-
-       if (!isset($_msgs_new)) {
-               if ( !($lang_et = cache(120, 'msgs_new', $_SESSION['lang'])) ) {
-                       global $db, $_base_path;
-
-                       $parent = Language::getParentCode($_SESSION['lang']);
-
-                       /* get $_msgs_new from the DB */
-                       $sql    = 'SELECT * FROM '.TABLE_PREFIX.'language_text WHERE variable="_msgs" AND (language_code="'.$_SESSION['lang'].'" OR language_code="'.$parent.'")';
-                       $result = @mysql_query($sql, $db);
-                       $i = 1;
-                       while ($row = @mysql_fetch_assoc($result)) {
-                               // do not cache key as a digit (no contstant(), use string)
-                               $_cache_msgs_new[$row['term']] = str_replace('SITE_URL/', $_base_path, $row['text']);
-                               if (TR_DEVEL) {
-                                       $_cache_msgs_new[$row['term']] .= ' <small><small>('.$row['term'].')</small></small>';
-                               }
-                       }
-
-                       cache_variable('_cache_msgs_new');
-                       endcache(true, false);
-               }
-               $_msgs_new = $_cache_msgs_new;
-       }
-
-       if (is_array($codes)) {
-               /* this is an array with terms to replace */            
-               $code           = array_shift($codes);
-
-               $message        = $_msgs_new[$code];
-               $terms          = $codes;
-
-               /* replace the tokens with the terms */
-               $message        = vsprintf($message, $terms);
-
-       } else {
-               $message = $_msgs_new[$codes];
-
-               if ($message == '') {
-                       /* the language for this msg is missing: */
-               
-                       $sql    = 'SELECT * FROM '.TABLE_PREFIX.'language_text WHERE variable="_msgs"';
-                       $result = @mysql_query($sql, $db);
-                       $i = 1;
-                       while ($row = @mysql_fetch_assoc($result)) {
-                               if (($row['term']) === $codes) {
-                                       $message = '['.$row['term'].']';
-                                       break;
-                               }
-                       }
-               }
-               $code = $codes;
-       }
-       return $message;
-}
-
 function html_get_list($array) {
        $list = '';
        foreach ($array as $value) {