From c895d2f41b0737f8a2799d36beca087e6b642f05 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Wed, 17 Dec 2008 21:00:03 -0500 Subject: Added an emoticon parsing system I decided that, because I use the :) emoticon so often, I might as well replace it with an actual image. I've added a Smiley parsing system to complement the BBCode parsing one. --- includes/bbcode.php | 2 +- includes/comments.php | 2 +- includes/functions.php | 2 +- includes/parsers.php | 36 +++++++++++++++++++++ includes/smilies.php | 64 +++++++++++++++++++++++++++++++++++++ index.php | 2 +- pages/admin.php | 6 ++-- pages/blog.php | 2 +- pages/poll.php | 2 +- pages/welcome.php | 2 +- rss.php | 4 +-- theme/images/smilies/001_smile.gif | Bin 0 -> 699 bytes 12 files changed, 112 insertions(+), 12 deletions(-) create mode 100755 includes/parsers.php create mode 100755 includes/smilies.php create mode 100644 theme/images/smilies/001_smile.gif diff --git a/includes/bbcode.php b/includes/bbcode.php index 42ff8d0..3cae84c 100755 --- a/includes/bbcode.php +++ b/includes/bbcode.php @@ -50,7 +50,7 @@ class BBCode $this->bbcodes['bquote'] = '

{CONTENT}
Anonymous
'; $this->bbcodes2['bquote'] = '

{CONTENT}
{PARAM}
'; $this->bbcodes2['abbr'] = '{CONTENT}'; - $this->bbcodes['hidden'] = '
{CONTENT}
'; + $this->bbcodes['hidden'] = '{CONTENT}'; $this->init = true; } diff --git a/includes/comments.php b/includes/comments.php index bf73318..15e9fc8 100755 --- a/includes/comments.php +++ b/includes/comments.php @@ -71,7 +71,7 @@ while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) 'USERNAME' => (($website != '') ? '' . $username . '' : $username), 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), 'ID' => $getcomments3[$i]['id'], - 'TEXT' => parseBBCode($getcomments3[$i]['comment']))); + 'TEXT' => parseText($getcomments3[$i]['comment']))); } $i++; } diff --git a/includes/functions.php b/includes/functions.php index 1caef59..881bfd1 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -124,7 +124,7 @@ function postBlogPost($title,$author,$tags,$content) $upconf = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdate\""; $upconf2 = mysql_query($upconf); - preg_match_all('|]*href="([^"]+)"|i', parseBBCode($content), $matches); + preg_match_all('|]*href="([^"]+)"|i', parseText($content), $matches); foreach ($matches[1] as $link) { diff --git a/includes/parsers.php b/includes/parsers.php new file mode 100755 index 0000000..5e984c2 --- /dev/null +++ b/includes/parsers.php @@ -0,0 +1,36 @@ + diff --git a/includes/smilies.php b/includes/smilies.php new file mode 100755 index 0000000..843af05 --- /dev/null +++ b/includes/smilies.php @@ -0,0 +1,64 @@ +smilies[':)'] = '001_smile.gif'; + + $this->init = true; + } + + function parseSmilies($text) + { + if (!$this->init) + { + $this->init(); + } + + foreach ($this->smilies as $name => $value) + { + $text = str_replace($name, '' . $name . '', $text); + } + + return $text; + } +} + +function parseSmilies($text) +{ + global $smilies; + if (!isset($smilies)) + { + $smilies = new Smilies(); + } + + return $smilies->parseSmilies($text); +} + +?> diff --git a/index.php b/index.php index 9faecc9..6a04591 100755 --- a/index.php +++ b/index.php @@ -27,7 +27,7 @@ include('includes/db.php'); include('includes/template.php'); include('includes/mantainence.php'); include('includes/session.php'); -include('includes/bbcode.php'); +include('includes/parsers.php'); include('includes/xmlrpc/xmlrpc.inc'); include('includes/specialdates.php'); include('includes/functions.php'); diff --git a/pages/admin.php b/pages/admin.php index aff21cf..a171b6f 100755 --- a/pages/admin.php +++ b/pages/admin.php @@ -240,7 +240,7 @@ if (isLoggedIn()) 'TITLE' => $getdraft3['title'], 'AUTHOR' => $getdraft3['author'], 'RATING' => 0, - 'TEXT' => parseBBCode($getdraft3['text']))); + 'TEXT' => parseText($getdraft3['text']))); $tags = getTags($getdraft3['id'], 'draft'); foreach ($tags as $tag) @@ -342,7 +342,7 @@ if (isLoggedIn()) 'TITLE' => $getpending3['title'], 'AUTHOR' => $getpending3['author'], 'RATING' => 0, - 'TEXT' => parseBBCode($getpending3['text']))); + 'TEXT' => parseText($getpending3['text']))); $tags = getTags($getpending3['id'], 'pending'); foreach ($tags as $tag) @@ -554,7 +554,7 @@ if (isLoggedIn()) $template->add('ID', $_GET['id']); $template->add('USERNAME', $getcomment3['author']); $template->add('CODEDEMAIL', md5(strtolower($getuser3['email']))); - $template->add('TEXT', parseBBCode($getcomment3['comment'])); + $template->add('TEXT', parseText($getcomment3['comment'])); $template->add('DATE', date("F dS Y \a\\t g:i:s a",strtotime($getcomment3['pubDate']))); } else { $template = new FITemplate('msg'); diff --git a/pages/blog.php b/pages/blog.php index d55f9a4..a03d3b1 100755 --- a/pages/blog.php +++ b/pages/blog.php @@ -72,7 +72,7 @@ if (isset($_GET['post'])) 'TITLE' => $getpost3['title'], 'AUTHOR' => $getpost3['author'], 'RATING' => $getpost3['rating'], - 'TEXT' => parseBBCode($getpost3['text']))); + 'TEXT' => parseText($getpost3['text']))); $tags = getTags($getpost3['id']); foreach ($tags as $tag) diff --git a/pages/poll.php b/pages/poll.php index 2dee559..d9cce70 100755 --- a/pages/poll.php +++ b/pages/poll.php @@ -112,7 +112,7 @@ if (isset($_GET['submit'])) if ($getrss3['id'] == $_GET['id']) { - $template->adds_block('COMPLETE', array( 'RSS' => parseBBCode($getrss3['rss']), + $template->adds_block('COMPLETE', array( 'RSS' => parseText($getrss3['rss']), 'AUTHOR' => $getrss3['author'], 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getrss3['date'])), 'OPTION1' => $getpoll3['option1'], diff --git a/pages/welcome.php b/pages/welcome.php index 6e06006..e224c8e 100755 --- a/pages/welcome.php +++ b/pages/welcome.php @@ -68,7 +68,7 @@ while ($getpost3 = mysql_fetch_array($getpost2)) 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), 'COMMENTS' => $comText, 'RATING' => $getpost3['rating'], - 'TEXT' => parseBBCode($getpost3['text']))); + 'TEXT' => parseText($getpost3['text']))); $tags = getTags($getpost3['id']); foreach ($tags as $tag) diff --git a/rss.php b/rss.php index c232fe3..176ea32 100755 --- a/rss.php +++ b/rss.php @@ -232,7 +232,7 @@ foreach ($items as $key => $value) http://fourisland.com/blog// - + @@ -260,7 +260,7 @@ foreach ($items as $key => $value) http://fourisland.com/#comment- - + diff --git a/theme/images/smilies/001_smile.gif b/theme/images/smilies/001_smile.gif new file mode 100644 index 0000000..f8dc278 Binary files /dev/null and b/theme/images/smilies/001_smile.gif differ -- cgit 1.4.1