[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] polls admin_addanswer.php, 1.14.2.2.2.5 vote.php, 1.
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] polls admin_addanswer.php, 1.14.2.2.2.5 vote.php, 1.9.2.1.4.1 admin_editanswer.php, 1.6.2.1.2.3 admin_editquestion.php, 1.8.2.1.2.5 admin_deletequestion.php, 1.4.4.3 admin_addquestion.php, 1.11.4.3 admin_deleteanswer.php, 1.6.2.2.2.2 |
Date: |
Thu, 8 Dec 2005 12:44:00 +0100 |
Update of polls
Modified Files:
Branch: Version-0_9_16-branch
admin_addanswer.php lines: +4 -4
vote.php lines: +20 -11
admin_editanswer.php lines: +13 -10
admin_editquestion.php lines: +6 -5
admin_deletequestion.php lines: +3 -4
admin_addquestion.php lines: +1 -2
admin_deleteanswer.php lines: +16 -7
Log Message:
globals, E_NOTICE, formatting & a variaton on patch #4476
====================================================
Index: polls/admin_addanswer.php
diff -u polls/admin_addanswer.php:1.14.2.2.2.4
polls/admin_addanswer.php:1.14.2.2.2.5
--- polls/admin_addanswer.php:1.14.2.2.2.4 Sun Feb 8 09:45:58 2004
+++ polls/admin_addanswer.php Thu Dec 8 11:44:59 2005
@@ -24,7 +24,7 @@
$GLOBALS['phpgw']->template->set_block('admin','form','form');
$GLOBALS['phpgw']->template->set_block('admin','row','row');
- if($_POST['submit'])
+ if ( isset($_POST['submit']) && $_POST['submit'] )
{
$poll_id = intval($_POST['poll_id']);
$answer =
$GLOBALS['phpgw']->db->db_addslashes(htmlentities($_POST['answer']));
@@ -35,7 +35,7 @@
$vote_id = ($GLOBALS['phpgw']->db->f(0) ?
$GLOBALS['phpgw']->db->f(0) : 1);
$GLOBALS['phpgw']->db->query('INSERT INTO phpgw_polls_data
(poll_id,option_text,option_count,vote_id) '
- . "VALUES
($poll_id,'$answer',0,$vote_id)",__LINE__,__FILE__);
+ . "VALUES ($poll_id, '$answer', 0,
$vote_id)",__LINE__,__FILE__);
$GLOBALS['phpgw']->template->set_var('message',lang('Answer has
been added to poll'));
}
@@ -47,7 +47,7 @@
$GLOBALS['phpgw']->template->set_var('form_button_2','</form><form
method="POST" action="' . $GLOBALS['phpgw']->link('/polls/admin.php') .
'"><input type="submit" name="submit" value="' . lang('Cancel') . '">');
$poll_select = '<select name="poll_id">';
- $GLOBALS['phpgw']->db->query("select * from
phpgw_polls_desc",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->query("SELECT * FROM
phpgw_polls_desc",__LINE__,__FILE__);
while ($GLOBALS['phpgw']->db->next_record())
{
$poll_select .= '<option value="' .
$GLOBALS['phpgw']->db->f('poll_id') . '"';
====================================================
Index: polls/vote.php
diff -u polls/vote.php:1.9 polls/vote.php:1.9.2.1.4.1
--- polls/vote.php:1.9 Fri Dec 21 14:59:46 2001
+++ polls/vote.php Thu Dec 8 11:44:59 2005
@@ -13,7 +13,8 @@
/* $Id$ */
- if ($HTTP_POST_VARS['submit'])
+ $GLOBALS['phpgw_info']['flags'] = array();
+ if ( isset($_POST['submit']) && $_POST['submit'] )
{
$GLOBALS['phpgw_info']['flags'] = array(
'noheader' => True,
@@ -25,23 +26,31 @@
$GLOBALS['phpgw_info']['flags']['enable_nextmatchs_class'] = True;
include('../header.inc.php');
- if ($HTTP_POST_VARS['submit'])
+ if ( isset($_POST['submit']) && $_POST['submit'] )
{
- if (verify_uservote($HTTP_POST_VARS['poll_id']))
+ if (verify_uservote($_POST['poll_id']))
{
+ $_POST['poll_id'] = intval($_POST['poll_id']);
+ $_POST['poll_voteNr'] = intval($_POST['poll_voteNr']);
+
//$GLOBALS['phpgw']->db->lock(array("phpgw_polls_data","phpgw_polls_user"));
- $GLOBALS['phpgw']->db->query("UPDATE phpgw_polls_data
SET option_count=option_count+1 WHERE "
- . "poll_id='" . $HTTP_POST_VARS['poll_id'] . "'
AND vote_id='" . $HTTP_POST_VARS['poll_voteNr'] . "'",__LINE__,__FILE__);
- $GLOBALS['phpgw']->db->query("insert into
phpgw_polls_user values ('" . $HTTP_POST_VARS['poll_id'] . "','','"
- . $GLOBALS['phpgw_info']['user']['account_id']
. "','" . time() . "')",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->query('UPDATE phpgw_polls_data
SET option_count=option_count+1'
+ . " WHERE poll_id = {$_POST['poll_id']} AND
vote_id = {$_POST['poll_voteNr']}",__LINE__,__FILE__);
+
+ $GLOBALS['phpgw']->db->query('INSERT INTO
phpgw_polls_user'
+ . " VALUES ({$_POST['poll_id']},
{$_POST['poll_voteNr']}, {$GLOBALS['phpgw_info']['user']['account_id']},"
+ . time() . ')',__LINE__,__FILE__);
+
//$GLOBALS['phpgw']->db->unlock();
}
- Header('Location: ' .
$GLOBALS['phpgw']->link('/polls/vote.php','show_results=' .
$HTTP_POST_VARS['poll_id']));
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/polls/vote.php','show_results=' . $_POST['poll_id']));
$GLOBALS['phpgw']->common->phpgw_exit();
}
- if ($HTTP_GET_VARS['show_results'])
+
+ if ( isset($_GET['show_results']) && $_GET['show_results'] )
{
- poll_viewResults($HTTP_GET_VARS['show_results']);
+ poll_viewResults($_GET['show_results']);
}
+
$GLOBALS['phpgw']->common->phpgw_footer();
?>
====================================================
Index: polls/admin_editanswer.php
diff -u polls/admin_editanswer.php:1.6.2.1.2.2
polls/admin_editanswer.php:1.6.2.1.2.3
--- polls/admin_editanswer.php:1.6.2.1.2.2 Sat Feb 21 00:45:04 2004
+++ polls/admin_editanswer.php Thu Dec 8 11:44:59 2005
@@ -11,7 +11,6 @@
/* $Id$ */
- $phpgw_info = array();
$GLOBALS['phpgw_info']['flags'] = array(
'admin_only' => True,
'currentapp' => 'polls',
@@ -24,34 +23,38 @@
$GLOBALS['phpgw']->template->set_block('admin','form','form');
$GLOBALS['phpgw']->template->set_block('admin','row','row');
- if ($_POST['submit'])
+ if ( isset($_POST['submit']) && $_POST['submit'] )
{
- $GLOBALS['phpgw']->db->query("UPDATE phpgw_polls_data SET
poll_id=" . intval($poll_id)
- . ", option_text='" .
$GLOBALS['phpgw']->db_addslashes($_POST['answer']) . "'"
- . ' WHERE vote_id = ' .
intval($_POST['$vote_id']),__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->query('UPDATE phpgw_polls_data'
+ . ' SET poll_id = ' . intval($_POST['new_poll_id']) .
','
+ . " option_text='" .
$GLOBALS['phpgw']->db->db_addslashes($_POST['answer']) . "'"
+ . ' WHERE vote_id = ' . intval($_GET['vote_id']
+ . ' AND poll_id = ' . intval($_POST['poll_id'])
), __LINE__, __FILE__);
$GLOBALS['phpgw']->template->set_var('message',lang('Answer has
been updated'));
+ $_REQUEST['poll_id'] = $_POST['new_poll_id'];
}
else
{
$GLOBALS['phpgw']->template->set_var('message','');
}
- $GLOBALS['phpgw']->db->query('SELECT * FROM phpgw_polls_data WHERE
vote_id=' . intval($_GET['vote_id'])
- . ' AND poll_id=' . intval($_GET['poll_id']), __LINE__,
__FILE__);
+ $GLOBALS['phpgw']->db->query('SELECT * FROM phpgw_polls_data WHERE
vote_id=' . intval($_REQUEST['vote_id'])
+ . ' AND poll_id=' . intval($_REQUEST['poll_id']),
__LINE__, __FILE__);
$GLOBALS['phpgw']->db->next_record();
$answer_value = $GLOBALS['phpgw']->db->f('option_text');
$poll_id = $GLOBALS['phpgw']->db->f('poll_id');
+ $GLOBALS['phpgw']->template->set_var('poll_id', $_REQEST['poll_id']);
$GLOBALS['phpgw']->template->set_var('header_message',lang('Edit
answer'));
$GLOBALS['phpgw']->template->set_var('td_message',' ');
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
-
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/polls/admin_editanswer.php','vote_id='
. $vote_id));
+
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/polls/admin_editanswer.php',
array('vote_id' => $_REQUEST['vote_id']) ) );
$GLOBALS['phpgw']->template->set_var('form_button_1','<input
type="submit" name="submit" value="' . lang('Edit') . '">');
$GLOBALS['phpgw']->template->set_var('form_button_2','</form><form
method="POST" action="' .
$GLOBALS['phpgw']->link('/polls/admin.php','show=answers')
. '"><input type="submit" name="submit" value="' .
lang('Cancel') . '">'
);
- $poll_select = '<select name="poll_id">';
+ $poll_select = '<select name="new_poll_id">';
$GLOBALS['phpgw']->db->query("select * from
phpgw_polls_desc",__LINE__,__FILE__);
while ($GLOBALS['phpgw']->db->next_record())
{
====================================================
Index: polls/admin_editquestion.php
diff -u polls/admin_editquestion.php:1.8.2.1.2.4
polls/admin_editquestion.php:1.8.2.1.2.5
--- polls/admin_editquestion.php:1.8.2.1.2.4 Wed Nov 10 22:43:22 2004
+++ polls/admin_editquestion.php Thu Dec 8 11:44:59 2005
@@ -24,13 +24,14 @@
$GLOBALS['phpgw']->template->set_block('admin','form','form');
$GLOBALS['phpgw']->template->set_block('admin','row','row');
- $poll_id = intval($_GET['poll_id'] ? $_GET['poll_id'] :
$_POST['poll_id']);
+ $poll_id = intval($_REQUEST['poll_id']);
- if ($_POST['edit'])
+ if ( isset($_POST['edit']) && $_POST['edit'] )
{
$question =
$GLOBALS['phpgw']->db->db_addslashes($_POST['question']);
- $GLOBALS['phpgw']->db->query("UPDATE phpgw_polls_desc SET
poll_title='$question'"
- . " WHERE poll_id=$poll_id",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->query('UPDATE phpgw_polls_desc'
+ . " SET poll_title = '$question'"
+ . " WHERE poll_id = $poll_id",__LINE__,__FILE__);
$GLOBALS['phpgw']->template->set_var('message',lang('Question
has been updated'));
}
else
====================================================
Index: polls/admin_deletequestion.php
diff -u polls/admin_deletequestion.php:1.4.4.2
polls/admin_deletequestion.php:1.4.4.3
--- polls/admin_deletequestion.php:1.4.4.2 Wed Dec 7 03:57:28 2005
+++ polls/admin_deletequestion.php Thu Dec 8 11:44:59 2005
@@ -11,13 +11,12 @@
/* $Id$ */
- $phpgw_info = array();
$GLOBALS['phpgw_info']['flags'] = array(
'currentapp' => 'polls',
'enable_nextmatchs_class' => True,
'admin_header' => True
);
- if ($_GET['confirm'])
+ if ( isset($_GET['confirm']) && $_GET['confirm'] )
{
$GLOBALS['phpgw_info']['flags']['noheader'] = True;
$GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
@@ -35,7 +34,7 @@
$max = intval($GLOBALS['phpgw']->db->f('pollmax'));
$GLOBALS['phpgw']->db->query("UPDATE phpgw_polls_settings SET
setting_value = $max "
. " WHERE setting_name='currentpoll'", __LINE__,
__FILE__);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/polls/admin.php','show=questions'));
+ $GLOBALS['phpgw']->redirect_link('/polls/admin.php',
array('show' => 'questions') );
}
else
{
====================================================
Index: polls/admin_addquestion.php
diff -u polls/admin_addquestion.php:1.11.4.2
polls/admin_addquestion.php:1.11.4.3
--- polls/admin_addquestion.php:1.11.4.2 Thu Jan 29 09:33:46 2004
+++ polls/admin_addquestion.php Thu Dec 8 11:44:59 2005
@@ -11,7 +11,6 @@
/* $Id$ */
- $phpgw_info = array();
$GLOBALS['phpgw_info']['flags'] = array(
'admin_only' => True,
'currentapp' => 'polls',
====================================================
Index: polls/admin_deleteanswer.php
diff -u polls/admin_deleteanswer.php:1.6.2.2.2.1
polls/admin_deleteanswer.php:1.6.2.2.2.2
--- polls/admin_deleteanswer.php:1.6.2.2.2.1 Thu Jan 29 05:39:04 2004
+++ polls/admin_deleteanswer.php Thu Dec 8 11:44:59 2005
@@ -26,19 +26,28 @@
}
include('../header.inc.php');
- if ($_GET['confirm'])
+ $_GET['poll_id'] = intval($_GET['poll_id']);
+ $_GET['vote_id'] = intval($_GET['vote_id']);
+
+ if ( isset($_GET['confirm']) && $_GET['confirm'] )
{
- $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_polls_data
WHERE '
- . 'vote_id = ' . intval($_GET['vote_id']) . ' AND
poll_id = ' . intval($_GET['poll_id']), __LINE__, __FILE__);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/polls/admin.php','show=answers'));
+ $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_polls_data '
+ . " WHERE vote_id = {$_GET['vote_id']} AND poll_id =
{$_GET['poll_id']}", __LINE__, __FILE__);
+
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/polls/admin.php', array('show' => 'answers') ) );
}
else
{
echo '<p><br><table border="0" width="40%"
align="center"><tr><td align="center" colspan="center">';
echo lang('Are you sure want to delete this answer ?') .
'</td></tr>';
echo '<tr><td align="left"><a href="' .
$GLOBALS['phpgw']->link('/polls/admin.php','show=answers') . '">' . lang('No')
. '</td>';
- echo ' <td align="right"><a href="' .
$GLOBALS['phpgw']->link('/polls/admin_deleteanswer.php','vote_id='
- . intval($_GET['vote_id']) . '&poll_id=' .
intval($_GET['poll_id']) . '&confirm=True') . '">' . lang('Yes') . '</td></tr>';
+ echo ' <td align="right"><a href="' .
$GLOBALS['phpgw']->link('/polls/admin_deleteanswer.php',
+ array
+ (
+ 'vote_id' => $_GET['vote_id'],
+ 'poll_id' => $_GET['poll_id'],
+ 'confirm' => 'True'
+ )) . '">' . lang('Yes') . '</td></tr>';
echo '</table>';
}
$GLOBALS['phpgw']->common->phpgw_footer();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] polls admin_addanswer.php, 1.14.2.2.2.5 vote.php, 1.9.2.1.4.1 admin_editanswer.php, 1.6.2.1.2.3 admin_editquestion.php, 1.8.2.1.2.5 admin_deletequestion.php, 1.4.4.3 admin_addquestion.php, 1.11.4.3 admin_deleteanswer.php, 1.6.2.2.2.2,
skwashd <=