Contributions by Keith Gable 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. In addition to being restricted by the GNU General Public License, Essence Engine may not be sold, rented, sublicensed, or leased; you are not permitted to generate revenue with the Essence Engine source code. You may, however, use Essence Engine to run a website that generates revenue via other means. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA $Id$ */ // Emoticon Manager // Add/edit/delete emoticons $pagetitle = "Emoticon Manager"; include("mainheader.php"); include("themeheader.php"); if ($userinfo["editemote"]) { // Add emotes if (($_GET["action"] == "add") || ($_GET["action"] == "edit")) { // Emoticons form has been submitted if ($_POST["submitted"]) { $modemote = $_POST; if ($_POST["image"] && $_POST["text"] && $_POST["description"]) { $doquery = "image='" . mysql_escape_string($_POST["image"]) . "', "; $doquery .= "text='" . mysql_escape_string($_POST["text"]) . "', "; $doquery .= "description='" . mysql_escape_string($_POST["description"]) . "', "; if ($_POST["disable"]) $doquery .= "disable='1'"; else $doquery .= "disable='0'"; if ($_GET["action"] == "add") $doquery = "INSERT INTO emoticons SET " . $doquery; elseif ($_GET["action"] == "edit") $doquery = "UPDATE emoticons SET " . $doquery . " WHERE id='" . mysql_escape_string($_POST["emoteid"]) . "' LIMIT 1"; $added = mysql_query($doquery, $db); if (mysql_errno() != 0) $errmsg = "MySQL Error " . mysql_errno() . ": " . mysql_error() . "."; else { if ($_GET["action"] == "add") sysmsg('Successfully added the "' . safetext($_POST["text"]) . '" emoticon.'); elseif ($_GET["action"] == "edit") sysmsg('Successfully edited the "' . safetext($_POST["text"]) . '" emoticon.'); sendlocation("adminemote.php?action=edit"); } } else $errmsg = "You must supply all of the information for the emoticon."; } elseif ($_GET["emoteid"]) { $emoteid = mysql_escape_string($_GET["emoteid"]); $result = mysql_query("SELECT * FROM emoticons WHERE id='" . $emoteid . "'", $db); $modemote = mysql_fetch_array($result); if (!isset($modemote["text"])) { $_SESSION["sysmsg"] = 'The emoticon id ' . safetext($emoteid) . ' does not exist.'; sendlocation("adminemote.php?action=edit"); } } if (($_GET["action"] == "add") || (($_GET["action"] == "edit") && (isset($modemote)))) { if ($errmsg) echo '
' . $errmsg . "
\n"; ?>
">
" />
" />
" />
/>
\n"; echo ' ' . "\n"; } else echo ' ' . "\n"; ?>
Add a new emoticon\n"; // Show the emote data echo "\n \n \n \n"; while ($emotes = mysql_fetch_array($result)) { echo " \n \n"; echo " \n"; echo ' \n"; echo " \n"; echo ' \n"; echo ' \n \n"; } echo "
TextImageDisabledDescriptionAction
" . safetext($emotes["text"]) . "\""'; if ($emotes["disable"]) echo "yes"; else echo "no"; echo "" . safetext($emotes["description"]) . "EditDelete
\n"; // Page count generator $result = mysql_query("SELECT count(*) FROM emoticons", $db); $totalemotes = mysql_fetch_array($result); $totalemotes = $totalemotes["count(*)"]; if ($totalemotes > $perpage) { $totalpages = ceil($totalemotes / $perpage); echo "
Go to page: \n"; for ($curpage = 1; $curpage <= $totalpages; ++$curpage) { if ($curpage == $pagenum) echo $curpage; else echo '' . $curpage . "\n"; if ($curpage != $totalpages) echo " - "; } echo "
\n"; } } } // Delete emotes elseif ($_GET["action"] == "delete") { if (($_GET["dodelete"]) && ($_GET["emoteid"])) { $emoteid = mysql_escape_string($_GET["emoteid"]); // Is the user allowed? if ($userinfo["editemote"]) { $deleteemote = mysql_query("DELETE FROM emoticons WHERE id='" . $emoteid . "' LIMIT 1", $db); if (mysql_errno() != 0) $_SESSION["sysmsg"] = "MySQL Error " . mysql_errno() . ": " . mysql_error() . "."; else $_SESSION["sysmsg"] = "Emoticon " . $emoteid . " was deleted successfully."; sendlocation("adminemote.php?action=edit"); } } elseif ($_GET["emoteid"]) { $emoteid = mysql_escape_string($_GET["emoteid"]); echo "
Do you really want to delete this emoticon?
\n"; echo "Yes, delete this emoticon.
\n"; echo "No, do not delete it.
\n"; $result = mysql_query("SELECT * FROM emoticons WHERE id=" . $emoteid, $db); $emote = mysql_fetch_array($result); ?>
Text to replace:
Image:" />
Description:
Access denied: You do not have permission to edit emoticons.\n"; include("themefooter.php"); ?>