default:
try {
- IMP::checkRequestToken('imp.compose', Horde_Util::getFormData('compose_requestToken'));
+ Horde::checkRequestToken('imp.compose', Horde_Util::getFormData('compose_requestToken'));
} catch (Horde_Exception $e) {
$notification->push($e);
$actionID = null;
$t->set('index', htmlspecialchars($index));
$t->set('status', Horde_Util::bufferOutput(array('IMP', 'status')));
$t->set('title', htmlspecialchars($title));
- $t->set('token', IMP::getRequestToken('imp.compose'));
+ $t->set('token', Horde::getRequestToken('imp.compose'));
if ($registry->hasMethod('contacts/search')) {
$t->set('has_search', true);
$hidden = array(
'actionID' => '',
'user' => $_SESSION['imp']['uniquser'],
- 'compose_requestToken' => IMP::getRequestToken('imp.compose'),
+ 'compose_requestToken' => Horde::getRequestToken('imp.compose'),
'compose_formToken' => Horde_Token::generateId('compose'),
'composeCache' => $composeCacheID,
'mailbox' => htmlspecialchars($imp_mbox['mailbox']),
next login. If IMP will be the exclusive means of accessing the mail server,
or you are not concerned about this behavior, this setting should be set to
true.">true</configboolean>
- <configinteger name="token_lifetime" desc="This is the length of time in
- seconds that links protected with request tokens (to prevent cross-site
- request forgery) will be valid. Higher values may make your users more
- vulnerable to these attacks.">1800</configinteger>
<configswitch name="cachejs" desc="Cache static javascript and combine into
a single page for delivery to the remote browser?">none
<case name="none" desc="No" />
$actionID = Horde_Util::getFormData('actionID');
if ($actionID) {
try {
- IMP::checkRequestToken('imp.folders', Horde_Util::getFormData('folders_token'));
+ Horde::checkRequestToken('imp.folders', Horde_Util::getFormData('folders_token'));
} catch (Horde_Exception $e) {
$notification->push($e);
$actionID = null;
$template->set('empty', ($actionID == 'folders_empty_mailbox_confirm'));
$template->set('folders', $loop);
$template->set('folders_url', $folders_url);
- $template->set('folders_token', IMP::getRequestToken('imp.folders'));
+ $template->set('folders_token', Horde::getRequestToken('imp.folders'));
echo $template->fetch(IMP_TEMPLATES . '/folders/folders_confirm.html');
require $registry->get('templates', 'horde') . '/common-footer.inc';
}
/* Token to use in requests */
-$folders_token = IMP::getRequestToken('imp.folders');
+$folders_token = Horde::getRequestToken('imp.folders');
$folders_url = Horde_Util::addParameter($folders_url, 'folders_token', $folders_token);
(intval($id) != 1) &&
(strpos($id, '.') === false)) {
$url = Horde_Util::removeParameter(Horde::selfUrl(true), array('actionID', 'imapid', 'index'));
- $url = Horde_Util::addParameter($url, array('actionID' => 'strip_attachment', 'imapid' => $id, 'index' => $this->_index, 'message_token' => IMP::getRequestToken('imp.impcontents')));
+ $url = Horde_Util::addParameter($url, array('actionID' => 'strip_attachment', 'imapid' => $id, 'index' => $this->_index, 'message_token' => Horde::getRequestToken('imp.impcontents')));
$part['strip'] = Horde::link($url, _("Strip Attachment"), 'stripAtc', null, "return window.confirm('" . addslashes(_("Are you sure you wish to PERMANENTLY delete this attachment?")) . "');") . '</a>';
}
}
/**
- * Get a token for protecting a form.
- *
- * @param string $slug TODO
- *
- * @return TODO
- */
- static public function getRequestToken($slug)
- {
- $token = Horde_Token::generateId($slug);
- $_SESSION['horde_form_secrets'][$token] = time();
- return $token;
- }
-
- /**
- * Check if a token for a form is valid.
- *
- * @param string $slug TODO
- * @param string $token TODO
- *
- * @throws Horde_Exception
- */
- static public function checkRequestToken($slug, $token)
- {
- if (empty($_SESSION['horde_form_secrets'][$token])) {
- throw new Horde_Exception(_("We cannot verify that this request was really sent by you. It could be a malicious request. If you intended to perform this action, you can retry it now."));
- }
-
- if ($_SESSION['horde_form_secrets'][$token] + $GLOBALS['conf']['server']['token_lifetime'] < time()) {
- throw new Horde_Exception(sprintf(_("This request cannot be completed because the link you followed or the form you submitted was only valid for %d minutes. Please try again now."), round($GLOBALS['conf']['server']['token_lifetime'] / 60)));
- }
- }
-
- /**
* Returns the plain text label that is displayed for the current mailbox,
* replacing virtual search mailboxes with an appropriate description and
* removing namespace and mailbox prefix information from what is shown to
$id = $this->_strip($id);
return Horde_Util::addParameter(Horde::applicationUrl('folders.php'),
array('actionID' => 'delete_search_query',
- 'folders_token' => IMP::getRequestToken('imp.folders'),
+ 'folders_token' => Horde::getRequestToken('imp.folders'),
'queryid' => $id,
));
}
}
if ($init_url == 'folders.php') {
- $url = Horde_Util::addParameter(Horde::applicationUrl($init_url, !$encode), array_merge(array('folders_token' => IMP::getRequestToken('imp.folders')), IMP::getComposeArgs()), null, $encode);
+ $url = Horde_Util::addParameter(Horde::applicationUrl($init_url, !$encode), array_merge(array('folders_token' => Horde::getRequestToken('imp.folders')), IMP::getComposeArgs()), null, $encode);
} else {
- $url = Horde_Util::addParameter(Horde::applicationUrl('mailbox.php', !$encode), array_merge(array('mailbox' => $init_url, 'mailbox_token' => IMP::getRequestToken('imp.mailbox')), IMP::getComposeArgs()), null, $encode);
+ $url = Horde_Util::addParameter(Horde::applicationUrl('mailbox.php', !$encode), array_merge(array('mailbox' => $init_url, 'mailbox_token' => Horde::getRequestToken('imp.mailbox')), IMP::getComposeArgs()), null, $encode);
}
if (!empty($actionID)) {
/* Run through the action handlers */
if ($actionID && ($actionID != 'message_missing')) {
try {
- IMP::checkRequestToken('imp.mailbox', Horde_Util::getFormData('mailbox_token'));
+ Horde::checkRequestToken('imp.mailbox', Horde_Util::getFormData('mailbox_token'));
} catch (Horde_Exception $e) {
$notification->push($e);
$actionID = null;
}
/* Token to use in requests */
-$mailbox_token = IMP::getRequestToken('imp.mailbox');
+$mailbox_token = Horde::getRequestToken('imp.mailbox');
/* Deal with filter options. */
if (!$readonly && !empty($_SESSION['imp']['filteravail'])) {
$imp_message->undelete($indices_array);
} else {
try {
- IMP::checkRequestToken('imp.message-mimp', Horde_Util::getFormData('mt'));
+ Horde::checkRequestToken('imp.message-mimp', Horde_Util::getFormData('mt'));
$imp_message->delete($indices_array);
if ($prefs->getValue('mailbox_return')) {
header('Location: ' . Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']), array('s' => $imp_mailbox->getMessageIndex()), null, false));
if (in_array('\\deleted', $flags)) {
$mset->add(new Horde_Mobile_link(_("Undelete"), Horde_Util::addParameter($self_link, array('a' => 'u'))));
} else {
- $mset->add(new Horde_Mobile_link(_("Delete"), Horde_Util::addParameter($self_link, array('a' => 'd', 'mt' => IMP::getRequestToken('imp.message-mimp')))));
+ $mset->add(new Horde_Mobile_link(_("Delete"), Horde_Util::addParameter($self_link, array('a' => 'd', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
}
}
$actionID = Horde_Util::getFormData('actionID');
if ($actionID && ($actionID != 'print_message')) {
try {
- IMP::checkRequestToken('imp.message', Horde_Util::getFormData('message_token'));
+ Horde::checkRequestToken('imp.message', Horde_Util::getFormData('message_token'));
} catch (Horde_Exception $e) {
$notification->push($e);
$actionID = null;
}
/* Token to use in requests */
-$message_token = IMP::getRequestToken('imp.message');
+$message_token = Horde::getRequestToken('imp.message');
/* We may have done processing that has taken us past the end of the
* message array, so we will return to mailbox.php if that is the
IMP::generateIMPUrl('mailbox.php', $mbox),
array('start' => $imp_mailbox->getArrayIndex($idx),
'actionID' => 'delete_messages',
- 'mailbox_token' => IMP::getRequestToken('imp.mailbox')));
+ 'mailbox_token' => Horde::getRequestToken('imp.mailbox')));
foreach ($thread as $val) {
$delete_link = Horde_Util::addParameter(
$delete_link,