mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 03:10:50 +02:00
Add admin logging to poll
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/admin_config.php,v $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-08-16 16:25:45 $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2008-08-17 11:54:38 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -31,10 +31,12 @@ require_once(e_PLUGIN."poll/poll_class.php");
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
|
||||
if(isset($_POST)) {
|
||||
if(isset($_POST))
|
||||
{
|
||||
$_POST = strip_if_magic($_POST);
|
||||
}
|
||||
|
||||
|
||||
$rs = new form;
|
||||
$poll = new poll;
|
||||
|
||||
@@ -42,7 +44,8 @@ if (isset($_POST['reset']))
|
||||
{
|
||||
unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['multipleChoice'], $_POST['showResults'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear']);
|
||||
define("RESET", TRUE);
|
||||
} else if (e_QUERY)
|
||||
}
|
||||
elseif (e_QUERY)
|
||||
{
|
||||
list($action, $id) = explode(".", e_QUERY);
|
||||
define("POLLACTION", $action);
|
||||
@@ -54,14 +57,16 @@ else
|
||||
define("POLLID", FALSE);
|
||||
}
|
||||
|
||||
if ($action == "delete") {
|
||||
|
||||
if ($action == "delete")
|
||||
{
|
||||
$message = $poll->delete_poll($id);
|
||||
unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate']);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
|
||||
if($_POST['poll_title'])
|
||||
{
|
||||
$message = $poll -> submit_poll();
|
||||
@@ -73,10 +78,12 @@ if (isset($_POST['submit']))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (POLLACTION == "edit" && !$_POST['preview'] && !$_POST['submit'])
|
||||
{
|
||||
|
||||
if ($sql->db_Select("polls", "*", "poll_id=".POLLID)) {
|
||||
if ($sql->db_Select("polls", "*", "poll_id=".POLLID))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
extract($row);
|
||||
|
||||
@@ -130,7 +137,8 @@ if (isset($message))
|
||||
$text = "<div style='text-align:center'><div style='padding : 1px; ".ADMIN_WIDTH."; height : 200px; overflow : auto; margin-left: auto; margin-right: auto;'>
|
||||
<form action='".e_SELF."' method='post' id='del_poll'>";
|
||||
|
||||
if ($poll_total = $sql->db_Select("polls", "*", "poll_type=1")) {
|
||||
if ($poll_total = $sql->db_Select("polls", "*", "poll_type=1"))
|
||||
{
|
||||
$text .= "<table class='fborder' style='width:99%'>
|
||||
<tr>
|
||||
<td style='width:5%' class='fcaption'>ID
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/languages/admin/English.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2008-08-16 16:25:45 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2008-08-17 11:54:40 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -25,6 +25,7 @@ define("POLL_ADLAN04", "The poll plugin has been successfully installed. To add
|
||||
define("POLL_ADLAN05", "Main Poll: ");
|
||||
define("POLL_ADLAN06", "Forum Thread: ");
|
||||
define("POLL_ADLAN07", "Type");
|
||||
define("POLL_ADLAN08", "Poll deleted");
|
||||
|
||||
define("POLLAN_MENU_CAPTION", "Poll");
|
||||
|
||||
@@ -73,8 +74,15 @@ define("POLLAN_41", "This poll is restricted to members only");
|
||||
define("POLLAN_42", "This poll is restricted to administrators only");
|
||||
define("POLLAN_43", "You do not have the required permissions to vote in this poll");
|
||||
define("POLLAN_44", "Delete this poll?");
|
||||
define("POLLAN_45", "Poll successfully updated");
|
||||
*/
|
||||
define("POLLAN_45", "Poll successfully updated");
|
||||
define("POLLAN_46", "Field(s) left blank");
|
||||
|
||||
// Log messages
|
||||
define('LAN_AL_POLL_01','Poll deleted');
|
||||
define('LAN_AL_POLL_02','Poll updated');
|
||||
define('LAN_AL_POLL_03','Poll added');
|
||||
define('LAN_AL_POLL_04','');
|
||||
define('LAN_AL_POLL_05','');
|
||||
|
||||
?>
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<e107Plugin>
|
||||
<!-- $Id: plugin.xml,v 1.1 2008-08-16 16:25:45 e107steved Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.2 2008-08-17 11:54:39 e107steved Exp $ -->
|
||||
<name>POLL_ADLAN01</name>
|
||||
<version>2.0</version>
|
||||
<author>Steve Dunstan (jalist)</author>
|
||||
@@ -9,6 +9,7 @@
|
||||
<compatibility>0.8</compatibility>
|
||||
<installRequired>true</installRequired>
|
||||
<folder>poll</folder>
|
||||
<logLanguageFile filename="languages/admin/--LAN--.php" />
|
||||
<commentID>poll</commentID>
|
||||
<administration>
|
||||
<configFile>admin_config.php</configFile>
|
||||
|
@@ -11,15 +11,14 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/poll_class.php,v $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2008-08-04 20:31:49 $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2008-08-17 11:54:39 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
@include_once(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
|
||||
@include_once(e_PLUGIN."poll/languages/English.php");
|
||||
@include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
|
||||
define("POLLCLASS", TRUE);
|
||||
define("POLL_MODE_COOKIE", 0);
|
||||
define("POLL_MODE_IP", 1);
|
||||
@@ -33,14 +32,15 @@ class poll
|
||||
|
||||
function delete_poll($existing)
|
||||
{
|
||||
global $sql;
|
||||
global $sql, $admin_log;
|
||||
if ($sql -> db_Delete("polls", " poll_id='".intval($existing)."' "))
|
||||
{
|
||||
if(function_exists("admin_purge_related"))
|
||||
{
|
||||
admin_purge_related("poll", $existing);
|
||||
}
|
||||
return "Poll deleted.";
|
||||
$admin_log->log_event('POLL_01',POLL_ADLAN08.': '.$existing,'');
|
||||
return POLL_ADLAN08;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class poll
|
||||
$mode = 2 :: poll is forum poll
|
||||
*/
|
||||
|
||||
global $tp, $sql;
|
||||
global $tp, $sql, $admin_log;
|
||||
|
||||
$poll_title = $tp->toDB($_POST['poll_title']);
|
||||
$poll_comment= $tp -> toDB($_POST['poll_comment']);
|
||||
@@ -74,7 +74,7 @@ class poll
|
||||
$sql -> db_Update("polls", "poll_title='{$poll_title}',
|
||||
poll_options='{$poll_options}',
|
||||
poll_comment='{$poll_comment}',
|
||||
poll_type=$mode,
|
||||
poll_type={$mode},
|
||||
poll_allow_multiple={$multipleChoice},
|
||||
poll_result_type={$showResults},
|
||||
poll_vote_userclass={$pollUserclass},
|
||||
@@ -97,9 +97,11 @@ class poll
|
||||
$sql -> db_Update("polls", "poll_votes='".$foo['poll_votes']."' WHERE poll_id='".intval(POLLID)."' ");
|
||||
}
|
||||
|
||||
$admin_log->log_event('POLL_02','ID: '.POLLID.' - '.$poll_title,'');
|
||||
$message = POLLAN_45;
|
||||
} else {
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$votes = "";
|
||||
for($a=1; $a<=count($_POST['poll_option']); $a++)
|
||||
{
|
||||
@@ -117,7 +119,8 @@ class poll
|
||||
$sql -> db_Update("polls", "poll_end_datestamp='".time()."', poll_vote_userclass='255' WHERE poll_id=".$deacpoll['poll_id']);
|
||||
}
|
||||
}
|
||||
$sql -> db_Insert("polls", "'0', ".time().", ".intval($active_start).", ".intval($active_end).", ".ADMINID.", '$poll_title', '$poll_options', '$votes', '', '1', '".$tp -> toDB($poll_comment)."', '".intval($multipleChoice)."', '".intval($showResults)."', '".intval($pollUserclass)."', '".intval($storageMethod)."'");
|
||||
$ret = $sql -> db_Insert("polls", "'0', ".time().", ".intval($active_start).", ".intval($active_end).", ".ADMINID.", '{$poll_title}', '{$poll_options}', '{$votes}', '', '1', '".$tp -> toDB($poll_comment)."', '".intval($multipleChoice)."', '".intval($showResults)."', '".intval($pollUserclass)."', '".intval($storageMethod)."'");
|
||||
$admin_log->log_event('POLL_03','ID: '.$ret.' - '.$poll_title,''); // Intentionally only log admin-entered polls
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user