function merge_custom_parameters($retval, $custom) { $lines = preg_split("/[\n;]/",$custom); foreach ($lines as $line){ $pos = strpos($line,"="); if ( $pos === false || $pos < 1 ) continue; $key = trim(substr($line, 0, $pos)); $val = trim(substr($line, $pos+1)); $key = 'custom_'.map_keyname($key); if ( isset($retval[$key])) continue; $retval[$key] = $val; } return $retval; }
function split_custom_parameters($customstr) { $lines = preg_split("/[\n;]/", $customstr); $retval = array(); foreach ($lines as $line) { $pos = strpos($line, "="); if ($pos === false || $pos < 1) { continue; } $key = trim(substr($line, 0, $pos)); $val = trim(substr($line, $pos + 1)); $key = map_keyname($key); $retval['custom_' . $key] = $val; } return $retval; }
if (trim($line['custom']) != '') { $toolcustarr = explode('&', $line['custom']); foreach ($toolcustarr as $custbit) { $pt = explode('=', $custbit); if (count($pt) == 2 && trim($pt[0]) != '' && trim($pt[1]) != '') { $pt[0] = map_keyname($pt[0]); $parms['custom_' . $pt[0]] = str_replace(array('$cid', '$userid', '$linkid'), array($cid, $userid, intval($_GET['linkid'])), $pt[1]); } } } if (trim($linkcustom) != '') { $toolcustarr = explode('&', $linkcustom); foreach ($toolcustarr as $custbit) { $pt = explode('=', $custbit); if (count($pt) == 2 && trim($pt[0]) != '' && trim($pt[1]) != '') { $pt[0] = map_keyname($pt[0]); $parms['custom_' . $pt[0]] = str_replace(array('$cid', '$userid', '$linkid'), array($cid, $userid, intval($_GET['linkid'])), $pt[1]); } } } $query = "SELECT FirstName,LastName,email FROM imas_users WHERE id='{$userid}'"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); list($firstname, $lastname, $email) = mysql_fetch_row($result); $parms['user_id'] = $userid; if (($line['privacy'] & 1) == 1) { $parms['lis_person_name_full'] = "{$firstname} {$lastname}"; $parms['lis_person_name_family'] = $lastname; $parms['lis_person_name_given'] = $firstname; } if (($line['privacy'] & 2) == 2) { $parms['lis_person_contact_email_primary'] = $email;