summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2007-11-25 17:34:19 +0000
committerthomascube <thomas@roundcube.net>2007-11-25 17:34:19 +0000
commitc5799618997716288169b6fbcd1251f76788cd49 (patch)
tree79e74cc848f8b6322ff223b77e300bd4e2a854b4 /program/steps
parent76b6bff70b3f7d8ff7eed261f7f9896cccae21f9 (diff)
Fixed some potential security risks + updatedd changelog
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/func.inc5
-rw-r--r--program/steps/mail/func.inc19
-rw-r--r--program/steps/mail/get.inc6
-rw-r--r--program/steps/mail/sendmail.inc2
-rw-r--r--program/steps/mail/show.inc4
5 files changed, 14 insertions, 22 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 574ef874e..b916ad796 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -32,10 +32,7 @@ $CONTACTS->set_pagesize($CONFIG['pagesize']);
// set list properties and session vars
if (!empty($_GET['_page']))
- {
- $CONTACTS->set_page(intval($_GET['_page']));
- $_SESSION['page'] = $_GET['_page'];
- }
+ $CONTACTS->set_page(($_SESSION['page'] = intval($_GET['_page'])));
else
$CONTACTS->set_page(isset($_SESSION['page']) ?$_SESSION['page'] : 1);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index c072c9118..95deaa4b9 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -30,16 +30,10 @@ if (empty($_SESSION['mbox']))
// set imap properties and session vars
if ($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC))
- {
- $IMAP->set_mailbox($mbox);
- $_SESSION['mbox'] = $mbox;
- }
+ $IMAP->set_mailbox(($_SESSION['mbox'] = $mbox));
if (!empty($_GET['_page']))
- {
- $IMAP->set_page((int)$_GET['_page']);
- $_SESSION['page'] = (int)$_GET['_page'];
- }
+ $IMAP->set_page(($_SESSION['page'] = intval($_GET['_page'])));
// set mailbox to INBOX if not set
if (empty($_SESSION['mbox']))
@@ -862,7 +856,7 @@ function rcmail_message_body($attrib)
if (!$attrib['id'])
$attrib['id'] = 'rcmailMsgBody';
- $safe_mode = (bool)$_GET['_safe'];
+ $safe_mode = intval($_GET['_safe']);
$attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
$out = '<div '. $attrib_str . ">\n";
@@ -1197,10 +1191,11 @@ function rcmail_message_part_controls()
{
global $CONFIG, $IMAP, $MESSAGE;
- if (!is_array($MESSAGE) || !is_array($MESSAGE['parts']) || !($_GET['_uid'] && $_GET['_part']) || !$MESSAGE['parts'][$_GET['_part']])
+ $part = get_input_value('_part', RCUBE_INPUT_GPC);
+ if (!is_array($MESSAGE) || !is_array($MESSAGE['parts']) || !($_GET['_uid'] && $_GET['_part']) || !$MESSAGE['parts'][$part])
return '';
- $part = &$MESSAGE['parts'][$_GET['_part']];
+ $part = &$MESSAGE['parts'][$part];
$attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'cellspacing', 'cellpadding', 'border', 'summary'));
$out = '<table '. $attrib_str . ">\n";
@@ -1230,7 +1225,7 @@ function rcmail_message_part_frame($attrib)
{
global $MESSAGE;
- $part = $MESSAGE['parts'][$_GET['_part']];
+ $part = $MESSAGE['parts'][get_input_value('_part', RCUBE_INPUT_GPC)];
$ctype_primary = strtolower($part->ctype_primary);
$attrib['src'] = Q('./?'.str_replace('_frame=', ($ctype_primary=='text' ? '_show=' : '_preload='), $_SERVER['QUERY_STRING']));
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index c9e40ac77..dad49d370 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -88,7 +88,7 @@ else if ($pid = get_input_value('_part', RCUBE_INPUT_GET))
// we have to analyze the whole structure again to find inline objects
list($new_parts, $new_attachments) =
rcmail_parse_message($MESSAGE['structure'],
- array('safe' => (bool)$_GET['_safe'],
+ array('safe' => intval($_GET['_safe']),
'prefer_html' => TRUE,
'get_url' => $GET_URL.'&_part=%s'));
@@ -102,7 +102,7 @@ else if ($pid = get_input_value('_part', RCUBE_INPUT_GET))
$part->body = $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part);
$OUTPUT = new rcube_html_page();
- $OUTPUT->write(rcmail_print_body($part, (bool)$_GET['_safe']));
+ $OUTPUT->write(rcmail_print_body($part, intval($_GET['_safe'])));
}
else
{
@@ -130,7 +130,7 @@ else
$cont = '';
list($MESSAGE['parts']) = rcmail_parse_message($MESSAGE['structure'],
- array('safe' => (bool)$_GET['_safe'],
+ array('safe' => intval($_GET['_safe']),
'get_url' => $GET_URL.'&_part=%s'));
$cont = "<html>\n<head><title></title>\n</head>\n<body>";
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index f1fd090d9..d118af53f 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -199,7 +199,7 @@ if (!empty($_SESSION['compose']['references']))
if (!empty($_POST['_priority']))
{
- $priority = (int)$_POST['_priority'];
+ $priority = intval($_POST['_priority']);
$a_priorities = array(1=>'highest', 2=>'high', 4=>'low', 5=>'lowest');
if ($str_priority = $a_priorities[$priority])
$headers['X-Priority'] = sprintf("%d (%s)", $priority, ucfirst($str_priority));
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index e25da03a6..4dcdec362 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -57,7 +57,7 @@ if ($_GET['_uid'])
if ($MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID']))
list($MESSAGE['parts'], $MESSAGE['attachments']) = rcmail_parse_message(
$MESSAGE['structure'],
- array('safe' => (bool)$_GET['_safe'],
+ array('safe' => intval($_GET['_safe']),
'prefer_html' => $CONFIG['prefer_html'],
'get_url' => $GET_URL.'&_part=%s')
);
@@ -71,7 +71,7 @@ if ($_GET['_uid'])
// give message uid to the client
$OUTPUT->set_env('uid', $MESSAGE['UID']);
- $OUTPUT->set_env('safemode', (bool)$_GET['_safe']);
+ $OUTPUT->set_env('safemode', intval($_GET['_safe']));
$next = $prev = -1;
// get previous, first, next and last message UID