159a160,161 > /* JDH Contact Patch > * OLD Code 160a163,165 > New Code > */ > if ($user->uid && !valid_email_address($user->mail)) { 176d180 < $form['#token'] = $user->name . $user->mail; 177a182,184 > /* JDH Contact Module > * OLD Code > $form['#token'] = $user->name . $user->mail; 181a189,214 > New Code*/ > if ($user->uid) { > // User is logged in so we'll use the account e-mail address. > $form['#token'] = $user->name . $user->mail; > $form['from'] = array('#type' => 'item', > '#title' => t('From'), > '#value' => check_plain($user->name) .' <'. check_plain($user->mail) .'>', > ); > } > else > { > // User is not logged in so we must ask for e-mail address and validate it. > $form['#token'] = $recipient->name . $recipient->mail; > $form['name'] = array('#type' => 'textfield', > '#title' => t('Your name'), > '#maxlength' => 255, > '#required' => TRUE, > ); > $form['mail'] = array('#type' => 'textfield', > '#title' => t('Your e-mail address'), > '#maxlength' => 255, > '#required' => TRUE, > '#validate' => array('contact_email_validate' => array()), > ); > } > /*NEW CODE END */ 195a229,230 > /*JDH Contact Patch > * OLD Code 198a234,242 > NEw Code Begin */ > // We do not allow anonymous users to send themselves a copy > // because it can be abused to spam people. > if ($user->uid) { > $form['copy'] = array('#type' => 'checkbox', > '#title' => t('Send yourself a copy.'), > ); > } > /*New Code End*/ 204a249,262 > /** > JDH Contact Module > NEW CODE > * Validate the personal contact page form submission. > */ > function contact_email_validate($form) { > $address = $form['#value']; > if (!valid_email_address($address)) { > form_error($form, t('%address is an invalid e-mail address.', array('%address' => $address))); > } > } > /* NEW CODE END */ > > 230a289,290 > /*JDH Contact Module Patch > *Old Code 231a292,299 > NEW Code Begin*/ > if ($user->uid) { > watchdog('mail', t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name))); > } > else { > watchdog('mail', t('%name-from sent %name-to an e-mail.', array('%name-from' => $form_values['name'] . ', ' . $form_values['mail'] . ',', '%name-to' => $account->name))); > } > /*New Code End*/