diff --git a/e107_core/bbcodes/bb_youtube.php b/e107_core/bbcodes/bb_youtube.php
index 979479ef9..e5ef5cdc9 100644
--- a/e107_core/bbcodes/bb_youtube.php
+++ b/e107_core/bbcodes/bb_youtube.php
@@ -4,16 +4,12 @@
| e107 website system
|
| Copyright (C) 2001-2002 Steve Dunstan (jalist@e107.org)
-| Copyright (C) 2008-2010 e107 Inc (e107.org)
+| Copyright (C) 2008-2013 e107 Inc (e107.org)
|
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
-| $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/emote.php $
-| $Revision: 11678 $
-| $Id: emote.php 11678 2010-08-22 00:43:45Z e107coders $
-| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
diff --git a/e107_core/bbcodes/code.bb b/e107_core/bbcodes/code.bb
index 24ee170b2..dab72e0a3 100644
--- a/e107_core/bbcodes/code.bb
+++ b/e107_core/bbcodes/code.bb
@@ -3,13 +3,15 @@ $class = e107::getBB()->getClass('code');
-global $pref, $e107cache, $tp;
+global $pref, $e107cache;
+
+$tp = e107::getParser();
if($pref['smiley_activate'])
{
if (!is_object($tp->e_emote))
{
- require_once(e_HANDLER.'emote_filter.php');
+ // require_once(e_HANDLER.'emote_filter.php');
$tp->e_emote = new e_emoteFilter;
}
$code_text = $tp->e_emote->filterEmotesRev($code_text);
diff --git a/e107_handlers/admin_handler.php b/e107_handlers/admin_handler.php
index de3a7f740..bc4769718 100644
--- a/e107_handlers/admin_handler.php
+++ b/e107_handlers/admin_handler.php
@@ -1,5 +1,5 @@
parseTemplate("{USER_AVATAR=".$avatar."}",true); instead.
+ */
function avatar($avatar)
{
return e107::getParser()->parseTemplate("{USER_AVATAR=".$avatar."}",true);
-
+ /*
global $tp;
if (stristr($avatar, '-upload-') !== false)
{
@@ -43,6 +47,7 @@ function avatar($avatar)
{
return $avatar;
}
+ */
}
?>
\ No newline at end of file
diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php
index 06da228a5..d29edc749 100644
--- a/e107_handlers/core_functions.php
+++ b/e107_handlers/core_functions.php
@@ -260,6 +260,44 @@ if (!function_exists('asortbyindex'))
}
}
+if (!function_exists('r_emote'))
+{
+ /**
+ * @DEPRECATED
+ */
+ function r_emote()
+ {
+ global $sysprefs, $pref;
+ $tp = e107::getParser();
+
+ if (!is_object($tp->e_emote))
+ {
+ // require_once(e_HANDLER.'emote_filter.php');
+ $tp->e_emote = new e_emoteFilter;
+ }
+
+ $str = '';
+ foreach($tp->e_emote->emotes as $key => $value) // filename => text code
+ {
+ $key = str_replace("!", ".", $key); // Usually '.' was replaced by '!' when saving
+ $key = preg_replace("#_(\w{3})$#", ".\\1", $key); // '_' followed by exactly 3 chars is file extension
+ $key = e_IMAGE."emotes/" . $pref['emotepack'] . "/" .$key; // Add in the file path
+
+ $value2 = substr($value, 0, strpos($value, " "));
+ $value = ($value2 ? $value2 : $value);
+ $value = ($value == '&|') ? ':((' : $value;
+ $value = " ".$value." ";
+ //TODO CSS class
+ $str .= "\n
";
+ }
+
+ return "
".$str."
";
+ }
+}
+
+
+
+
if (!function_exists('multiarray_sort'))
{
diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index c48ddeb08..87f4b2b0a 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -1272,8 +1272,10 @@ class e_parse extends e_parser
{
return $text;
}
+
+ $pref = e107::getPref();
- global $pref, $fromadmin;
+ global $fromadmin;
// Set default modifiers to start
$opts = $this->e_optDefault;
@@ -1570,7 +1572,7 @@ class e_parse extends e_parser
{
if (!is_object($this->e_emote))
{
- require_once(e_HANDLER.'emote_filter.php');
+ // require_once(e_HANDLER.'emote_filter.php');
$this->e_emote = new e_emoteFilter;
}
$sub_blk = $this->e_emote->filterEmotes($sub_blk);
@@ -1655,7 +1657,7 @@ class e_parse extends e_parser
{
if (!is_object($this->e_pf))
{
- require_once(e_HANDLER."profanity_filter.php");
+ // require_once(e_HANDLER."profanity_filter.php");
$this->e_pf = new e_profanityFilter;
}
$sub_blk = $this->e_pf->filterProfanities($sub_blk);
@@ -2901,3 +2903,151 @@ return $html;
}
+
+
+
+class e_emotefilter {
+ var $search;
+ var $replace;
+ var $emotes;
+
+ function e_emotefilter() /* constructor */
+ {
+ $pref = e107::getPref();
+
+ if(!$pref['emotepack'])
+ {
+ $pref['emotepack'] = "default";
+ save_prefs();
+ }
+
+ $this->emotes = e107::getConfig("emote")->getPref();
+
+ if(!vartrue($this->emotes))
+ {
+ return;
+ }
+
+ foreach($this->emotes as $key => $value)
+ {
+ $value = trim($value);
+
+ if ($value)
+ { // Only 'activate' emote if there's a substitution string set
+ $key = preg_replace("#!(\w{3,}?)$#si", ".\\1", $key);
+ // Next two probably to sort out legacy issues - may not be required any more
+ $key = preg_replace("#_(\w{3})$#", ".\\1", $key);
+ $key = str_replace("!", "_", $key);
+
+ $filename = e_IMAGE."emotes/" . $pref['emotepack'] . "/" . $key;
+
+ $fileloc = SITEURLBASE.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key;
+
+ if(file_exists($filename))
+ {
+ if(strstr($value, " "))
+ {
+ $tmp = explode(" ", $value);
+ foreach($tmp as $code)
+ {
+ $this->search[] = " ".$code;
+ $this->search[] = "\n".$code;
+ //TODO CSS class?
+ $this->replace[] = "
";
+ $this->replace[] = "\n
";
+ }
+ unset($tmp);
+ }
+ else
+ {
+ if($value)
+ {
+ $this->search[] = " ".$value;
+ $this->search[] = "\n".$value;
+ //TODO CSS class?
+ $this->replace[] = "
";
+ $this->replace[] = "\n
";
+ }
+ }
+ }
+ }
+ else
+ {
+ unset($this->emotes[$key]);
+ }
+ }
+ }
+
+ function filterEmotes($text)
+ {
+ $text = str_replace($this->search, $this->replace, $text);
+ return $text;
+ }
+
+ function filterEmotesRev($text)
+ {
+ $text = str_replace($this->replace, $this->search, $text);
+ return $text;
+ }
+}
+
+
+class e_profanityFilter
+{
+ var $profanityList;
+
+ function e_profanityFilter()
+ {
+ global $pref;
+
+ $words = explode(",", $pref['profanity_words']);
+ $word_array = array();
+ foreach($words as $word)
+ {
+ $word = trim($word);
+ if($word != "")
+ {
+ $word_array[] = $word;
+ if (strpos($word, '$') !== FALSE)
+ {
+ $word_array[] = str_replace('$', '\$', $word); // Special case - '$' may be 'in clear' or as entity
+ }
+ }
+ }
+ if(count($word_array))
+ {
+ $this->profanityList = str_replace('#','\#',implode("\b|\b", $word_array)); // We can get entities in the string - confuse the regex delimiters
+ }
+ unset($words);
+ return TRUE;
+ }
+
+ function filterProfanities($text)
+ {
+ global $pref;
+ if (!$this->profanityList)
+ {
+ return $text;
+ }
+ if ($pref['profanity_replace'])
+ {
+ return preg_replace("#\b".$this->profanityList."\b#is", $pref['profanity_replace'], $text);
+ }
+ else
+ {
+ return preg_replace_callback("#\b".$this->profanityList."\b#is", array($this, 'replaceProfanities'), $text);
+ }
+ }
+
+ function replaceProfanities($matches)
+ {
+ /*!
+ @function replaceProfanities callback
+ @abstract replaces vowels in profanity words with stars
+ @param text string - text string to be filtered
+ @result filtered text
+ */
+
+ return preg_replace("#a|e|i|o|u#i", "*" , $matches[0]);
+ }
+}
diff --git a/e107_handlers/emote.php b/e107_handlers/emote.php
index d5f10516d..bfd38e792 100644
--- a/e107_handlers/emote.php
+++ b/e107_handlers/emote.php
@@ -1,21 +1,16 @@
".$str."";
}
-
+*/
?>
\ No newline at end of file
diff --git a/e107_handlers/emote_filter.php b/e107_handlers/emote_filter.php
index 0de1b4191..2aeebbd89 100644
--- a/e107_handlers/emote_filter.php
+++ b/e107_handlers/emote_filter.php
@@ -1,27 +1,23 @@
profanityList."\b#is", array($this, 'replaceProfanities'), $text);
}
}
-
- function replaceProfanities($matches)
- {
- /*!
- @function replaceProfanities callback
+ *
+ *
+ // @function replaceProfanities callback
@abstract replaces vowels in profanity words with stars
@param text string - text string to be filtered
@result filtered text
- */
+
+ function replaceProfanities($matches)
+ {
+
return preg_replace("#a|e|i|o|u#i", "*" , $matches[0]);
}
}
+*/
+
?>
diff --git a/e107_handlers/ren_help.php b/e107_handlers/ren_help.php
index e22248d73..8dffb1a13 100644
--- a/e107_handlers/ren_help.php
+++ b/e107_handlers/ren_help.php
@@ -314,7 +314,7 @@ function PreFile_Select($formid='prefile_selector')
}
function Emoticon_Select($formid='emoticon_selector') {
- require_once(e_HANDLER."emote.php");
+ // require_once(e_HANDLER."emote.php");
$text ="