by tonreproc » Wed Jan 05, 2011 1:07 am
Hi Alec,
the hash keys in e-mail and database match, that seems to be OK.
The routine you asked for (is this what you mean?, this file is patched with the #5984 patch):
function unsubscribeGuest($email, $password) {
$application =& PKPApplication::getApplication();
$productName = $application->getName();
$context =& Request::getContext();
$contextId = $context->getId();
$result =& $this->retrieve(
'SELECT setting_id FROM notification_settings WHERE setting_name = ? AND product = ? AND context = ?',
array(
'mailList',
$productName,
(int) $contextId
)
);
$row = $result->GetRowAssoc(false);
$userId = (int) $row['setting_id'];
$result->Close();
unset($result);
import('security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
$accessKeyHash = AccessKeyManager::generateKeyHash($password);
$accessKey = $accessKeyManager->validateKey('MailListContext', $userId, $accessKeyHash);
if ($accessKey) {
$this->update(
'DELETE FROM notification_settings WHERE setting_name = ? AND setting_value = ? AND product = ? AND context = ?',
array(
'mailList',
$email,
$productName,
(int) $contextId
)
);
$accessKeyDao =& DAORegistry::getDAO('AccessKeyDAO');
$accessKeyDao->deleteObject($accessKey);
return true;
} else return false;
}