Update of /cvsroot/openfirst/emoticon
In directory sc8-pr-cvs1:/tmp/cvs-serv12636
Added Files:
index.php
Log Message:
initial upload
--- NEW FILE: index.php ---
<?php
/*
* openFIRST.emoticon - index.php
*
* Copyright (C) 2003,
* openFIRST Project
* Original Author: Tim Ginn <tim...@po...>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
mysql_select_db($sqldatabase,$sqlconnection);
// Switches all emoticon text for the
// proper symbol and returns the
// switched text.
function emoticon_translate ($text)
{
$query = mysql_query("SELECT * FROM ofirst_emoticon");
if (mysql_num_rows($query) != 0){
while ($er = mysql_fetch_object($query)) {
$text = str_replace($er->emoticon, $er->substitution, $text);
}
}
return $text;
}
// Displays emoticons in a table.
// Its a good function to place on a messaging system
// or have as reference page.
function emoticon_preview ()
{
$query = mysql_query("SELECT * FROM ofirst_emoticon LIMIT 0,5");
echo "<table>";
while ($emot = mysql_fetch_object($query)) {
echo "<tr><td>".$emot->substitution."</td><td>".$emot->emoticon."</td></tr>";
}
echo "</table>";
}
// Analyzis database and compares slur words
// then it replaces the slur words with its
// substitution value.
function slur_block ($text)
{
$query = mysql_query("SELECT * FROM ofirst_slurblock");
if (mysql_num_rows($query) != 0){
while ($er = mysql_fetch_object($query)) {
$text = str_replace($er->slur, $er->substitution, $text);
}
}
return $text;
}
?>
|