2006-12-02 04:36:16 +00:00
|
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
+ ----------------------------------------------------------------------------+
|
|
|
|
|
| e107 website system
|
|
|
|
|
|
|
|
|
|
|
| <EFBFBD>Steve Dunstan 2001-2002
|
|
|
|
|
| http://e107.org
|
|
|
|
|
| jalist@e107.org
|
|
|
|
|
|
|
|
|
|
|
| Released under the terms and conditions of the
|
|
|
|
|
| GNU General Public License (http://gnu.org).
|
|
|
|
|
|
|
|
|
|
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/admin_config.php,v $
|
2009-07-10 14:25:23 +00:00
|
|
|
|
| $Revision: 1.8 $
|
|
|
|
|
| $Date: 2009-07-10 14:25:22 $
|
|
|
|
|
| $Author: e107coders $
|
2006-12-02 04:36:16 +00:00
|
|
|
|
+----------------------------------------------------------------------------+
|
|
|
|
|
*/
|
|
|
|
|
require_once("../../class2.php");
|
|
|
|
|
if (!is_object($tp)) $tp = new e_parse;
|
2008-12-11 21:13:48 +00:00
|
|
|
|
if (!getperms("P") || !plugInstalled('poll'))
|
2008-08-16 16:25:45 +00:00
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
header("location:".e_BASE."index.php");
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
$e_sub_cat = 'poll';
|
|
|
|
|
|
2008-12-11 21:13:48 +00:00
|
|
|
|
include_lan(e_PLUGIN.'poll/languages/English_admin_poll.php');
|
2006-12-02 04:36:16 +00:00
|
|
|
|
require_once(e_ADMIN."auth.php");
|
|
|
|
|
require_once(e_PLUGIN."poll/poll_class.php");
|
|
|
|
|
require_once(e_HANDLER."form_handler.php");
|
|
|
|
|
require_once(e_HANDLER."userclass_class.php");
|
|
|
|
|
|
2008-08-17 11:54:40 +00:00
|
|
|
|
if(isset($_POST))
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$_POST = strip_if_magic($_POST);
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-17 11:54:40 +00:00
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$rs = new form;
|
|
|
|
|
$poll = new poll;
|
|
|
|
|
|
|
|
|
|
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);
|
2008-08-17 11:54:40 +00:00
|
|
|
|
}
|
|
|
|
|
elseif (e_QUERY)
|
2006-12-02 04:36:16 +00:00
|
|
|
|
{
|
|
|
|
|
list($action, $id) = explode(".", e_QUERY);
|
|
|
|
|
define("POLLACTION", $action);
|
|
|
|
|
define("POLLID", $id);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
define("POLLACTION", FALSE);
|
|
|
|
|
define("POLLID", FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-17 11:54:40 +00:00
|
|
|
|
|
|
|
|
|
if ($action == "delete")
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$message = $poll->delete_poll($id);
|
|
|
|
|
unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate']);
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-17 11:54:40 +00:00
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
if (isset($_POST['submit']))
|
|
|
|
|
{
|
|
|
|
|
if($_POST['poll_title'])
|
|
|
|
|
{
|
|
|
|
|
$message = $poll -> submit_poll();
|
|
|
|
|
unset($_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['poll_comment']);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$message = POLLAN_46;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-17 11:54:40 +00:00
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
if (POLLACTION == "edit" && !$_POST['preview'] && !$_POST['submit'])
|
|
|
|
|
{
|
|
|
|
|
|
2008-08-17 11:54:40 +00:00
|
|
|
|
if ($sql->db_Select("polls", "*", "poll_id=".POLLID))
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$row = $sql->db_Fetch();
|
|
|
|
|
extract($row);
|
|
|
|
|
|
|
|
|
|
$tmpArray = explode(chr(1), $poll_options);
|
|
|
|
|
|
|
|
|
|
foreach($tmpArray as $option)
|
|
|
|
|
{
|
|
|
|
|
$_POST['poll_option'][] = $option;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$_POST['activate'] = $poll_active;
|
|
|
|
|
$_POST['option_count'] = count($_POST['poll_option']);
|
|
|
|
|
$_POST['poll_title'] = $poll_title;
|
|
|
|
|
$_POST['poll_comment'] = $poll_comment;
|
|
|
|
|
|
|
|
|
|
if ($poll_start_datestamp)
|
|
|
|
|
{
|
|
|
|
|
$tmp = getdate($poll_start_datestamp);
|
|
|
|
|
$_POST['startmonth'] = $tmp['mon'];
|
|
|
|
|
$_POST['startday'] = $tmp['mday'];
|
|
|
|
|
$_POST['startyear'] = $tmp['year'];
|
|
|
|
|
}
|
|
|
|
|
if ($poll_end_datestamp)
|
|
|
|
|
{
|
|
|
|
|
$tmp = getdate($poll_end_datestamp);
|
|
|
|
|
$_POST['endmonth'] = $tmp['mon'];
|
|
|
|
|
$_POST['endday'] = $tmp['mday'];
|
|
|
|
|
$_POST['endyear'] = $tmp['year'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$_POST['multipleChoice'] = $poll_allow_multiple;
|
|
|
|
|
$_POST['showResults'] = $poll_result_type;
|
2007-11-01 22:47:27 +00:00
|
|
|
|
// Can't have everyone voting if tracking method is user ID
|
|
|
|
|
$_POST['pollUserclass'] = (($poll_vote_userclass == e_UC_PUBLIC) && $poll_storage_method == 2) ? e_UC_MEMBER : $poll_vote_userclass;
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$_POST['storageMethod'] = $poll_storage_method;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($_POST['preview']))
|
|
|
|
|
{
|
2007-11-01 22:47:27 +00:00
|
|
|
|
// Can't have everyone voting if tracking method is user ID
|
|
|
|
|
if (($_POST['pollUserclass'] == e_UC_PUBLIC) && ($_POST['storageMethod'] == 2)) $_POST['pollUserclass'] = e_UC_MEMBER;
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$poll->render_poll($_POST, "preview");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($message))
|
|
|
|
|
{
|
|
|
|
|
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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'>";
|
|
|
|
|
|
2008-08-17 11:54:40 +00:00
|
|
|
|
if ($poll_total = $sql->db_Select("polls", "*", "poll_type=1"))
|
|
|
|
|
{
|
2009-07-10 14:25:23 +00:00
|
|
|
|
$text .= "<table class='adminlist' cellpadding='0' cellspacing='0'>
|
|
|
|
|
<colgroup span='3'>
|
|
|
|
|
<col style='width:5%' />
|
|
|
|
|
<col style='width:75%' />
|
|
|
|
|
<col style='width:20%' />
|
|
|
|
|
</colgroup>
|
|
|
|
|
<thead>
|
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
<tr>
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<th>ID
|
2006-12-02 04:36:16 +00:00
|
|
|
|
<input type='hidden' name='del_poll_confirm' id='del_poll_confirm' value='1' />
|
2009-07-10 14:25:23 +00:00
|
|
|
|
</th>
|
|
|
|
|
<th>".POLLAN_3."</th>
|
|
|
|
|
<th class='center'>".POLLAN_4."</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
while ($row = $sql->db_Fetch()) {
|
|
|
|
|
extract($row);
|
|
|
|
|
$text .= "<tr>
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<td style='width:5%' >$poll_id</td>
|
2007-01-07 15:59:42 +00:00
|
|
|
|
<td style='width:75%' class='forumheader3'>".$tp -> toHTML($poll_title, TRUE,"no_hook, emotes_off, defs")."</td>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
<td style='width:20%; text-align:center' class='forumheader3'><div>". $rs->form_button("button", "main_edit_{$poll_id}", POLLAN_5, "onclick=\"document.location='".e_SELF."?edit.$poll_id'\""). $rs->form_button("submit", "main_delete_{$poll_id}", POLLAN_6, "onclick=\"confirm_($poll_id)\"")."
|
|
|
|
|
</div></td>
|
|
|
|
|
</tr>";
|
|
|
|
|
}
|
2009-07-10 14:25:23 +00:00
|
|
|
|
$text .= "</tbody></table>";
|
2007-11-01 22:47:27 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$text .= "<div style='text-align:center'>".POLLAN_7."</div>";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
}
|
|
|
|
|
$text .= "</form></div></div>";
|
|
|
|
|
$ns->tablerender(POLLAN_1, $text);
|
|
|
|
|
|
|
|
|
|
$poll_total = $sql->db_Select("polls");
|
|
|
|
|
|
|
|
|
|
$text = $poll -> renderPollForm();
|
|
|
|
|
|
|
|
|
|
$ns->tablerender(POLLAN_2, $text);
|
|
|
|
|
require_once(e_ADMIN."footer.php");
|
2007-11-01 22:47:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function headerjs()
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
global $tp;
|
|
|
|
|
$headerjs = "<script type=\"text/javascript\">
|
2007-11-01 22:47:27 +00:00
|
|
|
|
function confirm_(poll_id)
|
|
|
|
|
{
|
|
|
|
|
var x=confirm(\"Delete this poll? [ID: \" + poll_id + \"]\");
|
|
|
|
|
if (x)
|
|
|
|
|
{
|
|
|
|
|
document.getElementById('del_poll').action='".e_SELF."?delete.' + poll_id;
|
|
|
|
|
document.getElementById('del_poll').submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
return $headerjs;
|
|
|
|
|
}
|
|
|
|
|
?>
|