Download & Extend

keeping the orginal page, referer

Project:tellafriend
Version:6.x-2.8
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi,
I wanted my user to send the content link, not the site link.
I changed tellafriend_page_submit function. I added a new variable $sitelink, and change it if required.

global $base_url;
global $language;

  $sitelink   = $base_url;
  if(isset($_SERVER['HTTP_REFERER'])&&($url = parse_url($_SERVER['HTTP_REFERER']))){
     //I think using same domain is enough to check spamming
     $sitelink  = stripos($base_url, $url['host'])?"{$url['scheme']}://{$base_url}{$url['path']}{$url['query']}":"{$base_url}";
  }else{
     trigger_error("Where is he coming from?", E_WARNING);
  }
  $placeholder_values = array('!sitename' => variable_get('site_name', 'Drupal'),'!sitelink' => $sitelink,'!sitemail' => variable_get('site_mail', ini_get('sendmail_from')), '!sendername' => $form_state['values']['tellafriend_name'], '!sendermail' => $form_state['values']['tellafriend_email']);
nobody click here