require_once W2P_BASE_DIR . '/classes/ui.class.php'; $AppUI = new w2p_Core_CAppUI(); $updatekey = w2PgetParam($_POST, 'updatekey', 0); $contact_id = (int) CContact::getContactByUpdatekey($updatekey); if (!$contact_id) { echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact the sender to give you another valid link, thank you.'); exit; } $contact = new CContact(); if (!$contact->bind($_POST)) { $msg = $AppUI->_('There was an error recording your contact data, please contact the system administrator. Thank you very much.'); } else { $result = $contact->store(); if (is_array($result)) { $msg = $AppUI->_('There was an error recording your contact data, please contact the system administrator. Thank you very much.'); } else { $custom_fields = new w2p_Core_CustomFields('contacts', 'addedit', $contact->contact_id, 'edit', 1); $custom_fields->bind($_POST); $custom_fields->store($contact->contact_id); $contact->clearUpdateKey(); $msg = $AppUI->_('Your contact data has been recorded successfully. Your may now close your browser window. Thank you very much, ' . $contact->contact_first_name); } } ?> <html> <body> <?php echo $msg; ?> </body> </html>
public function testClearUpdateKey() { $contact = new CContact(); $contact->load(1); $this->assertEquals('ASDFASDFASDF', $contact->contact_updatekey); $contact->clearUpdateKey(); $this->assertEquals('', $contact->contact_updatekey); $contact = new CContact(); $contact->contact_id = 1; $this->assertEquals('', $contact->getUpdateKey()); }