| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: referral.module,v 1.16.2.8 2008/11/30 00:55:02 kbahey Exp $ |
// $Id: referral.module,v 1.16.2.9 2008/11/30 18:11:05 kbahey Exp $ |
| 4 |
|
|
| 5 |
/** |
/** |
| 6 |
* @file |
* @file |
| 163 |
return; |
return; |
| 164 |
} |
} |
| 165 |
|
|
| 166 |
|
// Retrieve referral info from the cookie |
| 167 |
$cookie = unserialize($_COOKIE[REFERRAL_COOKIE]); |
$cookie = unserialize($_COOKIE[REFERRAL_COOKIE]); |
| 168 |
|
|
| 169 |
|
if (empty($cookie)) { |
| 170 |
|
// Nothing to do ... |
| 171 |
|
return; |
| 172 |
|
} |
| 173 |
|
|
| 174 |
db_query("INSERT INTO {referral} (uid, referral_uid, created, host, http_referer) VALUES (%d, %d, %d, '%s', '%s')", |
db_query("INSERT INTO {referral} (uid, referral_uid, created, host, http_referer) VALUES (%d, %d, %d, '%s', '%s')", |
| 175 |
$uid, |
$uid, |
| 176 |
$cookie['uid'], |
$cookie['uid'], |
| 178 |
$cookie['ip'], |
$cookie['ip'], |
| 179 |
$cookie['referer']); |
$cookie['referer']); |
| 180 |
|
|
| 181 |
if (db_affected_rows()) { |
if (!db_affected_rows()) { |
| 182 |
watchdog('referral', 'INSERT of referral data failed.', array(), WATCHDOG_ERROR); |
watchdog('referral', 'INSERT of referral data failed.', array(), WATCHDOG_ERROR); |
| 183 |
return; |
return; |
| 184 |
} |
} |
| 185 |
|
|
| 186 |
// Invoke other modules hooks ... |
// Invoke other modules hooks ... |
| 187 |
$account = user_load(array('uid' => $cookie['uid'])); |
module_invoke_all('referral', $uid, $cookie['uid']); |
|
$referred_user = array('#uid' => $uid); |
|
|
module_invoke_all('user', 'referral', $referred_user, $account); |
|
| 188 |
} |
} |
| 189 |
|
|
| 190 |
function _referral_user_delete($uid) { |
function _referral_user_delete($uid) { |