本文整理汇总了PHP中drupal_get_private_key函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_get_private_key函数的具体用法?PHP drupal_get_private_key怎么用?PHP drupal_get_private_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_get_private_key函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_new_user
function create_new_user(&$row)
{
msg('create_new_user');
if (!$row->is_cell_valid && !$row->is_email_valid) {
msg("no email and no cell");
$log = import_user_log_get_default($user->uid, $row->record_id, 'import', 'no-cell-or-email');
import_user_log_insert($log);
return false;
}
if (user_exists_by_phone($row)) {
msg('user_exists_by_phone');
return false;
}
if (user_exists_by_email($row)) {
msg('user_exists_by_email');
return false;
}
msg('creating');
$log_type = 'import';
$log_value = 'new';
$existing_log = import_user_log_get_by_rid_type($row->record_id, $log_type);
if ($existing_log) {
msg('already have a log for this id,type ' . $row->record_id . ',' . $log_type);
return false;
}
// cell
$number = $row->cell;
if (strlen($number) > 0) {
$sms_user[0] = array(status => 2, number => $number);
}
// password
// just a random sha hash including time so we can set the password
// we don't know/don't care what it is
// it's secure and will need to be reset by the user if they register via email later
$token = base64_encode(hash_hmac('sha256', $number, drupal_get_private_key() . time(), TRUE));
$token = strtr($token, array('+' => '-', '/' => '_', '=' => ''));
$details = array('name' => strlen($row->handle) > 1 ? $row->handle . $row->record_id : $number, 'pass' => $token, 'mail' => $row->is_email_valid ? $row->email : $number, 'access' => 0, 'status' => 1, 'sms_user' => $sms_user);
$user = user_save(null, $details);
// set values for the imported profile fields
healthimo_profile_save($user, 'profile_age', $row->age, null);
healthimo_profile_save($user, 'profile_zip_code', $row->zip, null);
healthimo_profile_save($user, 'profile_gender', $row->gender, null);
healthimo_profile_save($user, 'profile_goal', $row->goal, null);
healthimo_profile_save($user, 'profile_areas_of_interest_reply', $row->interest_areas, null);
healthimo_profile_save($user, 'profile_areas_of_interest_diabetes', $row->interest_diabetes, null);
//healthimo_profile_save($user, 'xxxxxxxxxxx', $row->interest_asthma, null);
if ($user) {
msg("import_user created user {$user->uid}");
// link to import record
$log = import_user_log_get_default($user->uid, $row->record_id, $log_type, $log_value);
import_user_log_insert($log);
print_r($user);
return $user;
}
return false;
}
示例2: drupalGetToken
/**
* Generate a token for the currently logged in user.
*/
protected function drupalGetToken($value = '')
{
$private_key = drupal_get_private_key();
return drupal_hmac_base64($value, $this->session_id . $private_key);
}
示例3: drupalGetToken
/**
* Generate a token for the currently logged in user.
*/
protected function drupalGetToken($value = '')
{
$private_key = drupal_get_private_key();
return md5($this->session_id . $value . $private_key);
}
示例4: setComponentID
/**
* Set a secure componentId based on the options values and the drupal private key.
*/
protected function setComponentID()
{
$base64 = implode('@', $this->getOptions());
$base64 = base64_encode($base64);
$this->_componentID = $this->pluginType['name'] . md5($base64 . drupal_get_private_key() . drupal_get_hash_salt());
}
示例5: create_new_account_with_sms
function create_new_account_with_sms($number)
{
$sms_user[0] = array(status => 2, number => $number);
// just a random sha hash including time so we can set the password
// we don't know/don't care what it is
// it's secure and will need to be reset by the user if they register via email later
$token = base64_encode(hash_hmac('sha256', $number, drupal_get_private_key() . time(), TRUE));
$token = strtr($token, array('+' => '-', '/' => '_', '=' => ''));
$details = array('name' => $number, 'pass' => $token, 'mail' => $number, 'access' => 0, 'status' => 1, 'sms_user' => $sms_user);
return user_save(null, $details);
}
示例6: variable_get
$bytes = '';
// Build the server path
$base_path = variable_get('bt_web_seed_dir', 'files/' . md5(drupal_get_private_key()) . '-web-seeding/');
$path = $base_path . $torrent['info']['name'];
// Open the file
$handle = fopen($path, 'rb');
foreach ($request['range'] as $range) {
fseek($handle, $range[0]);
$bytes .= fread($handle, $range[1] - $range[0]);
}
fclose($handle);
} else {
// Multiple file torrent
$bytes = '';
//Build the root server path
$base_path = variable_get('bt_web_seed_dir', 'files/' . md5(drupal_get_private_key()) . '-web-seeding/');
$path = $base_path . $torrent['info']['name'];
// Create an array of files in the torrent
$files = array();
$byte_offset = 0;
foreach ($torrent['info']['files'] as $file) {
$file_path = '';
foreach ($file['path'] as $torrent_file_path) {
$file_path .= '/' . $torrent_file_path;
}
$files[] = array('path' => $file_path, 'byte_start' => $byte_offset, 'byte_end' => $byte_offset + $file['length']);
$byte_offset += $file['length'];
}
// Process the ranges
foreach ($request['range'] as $range) {
$byte_offset = 0;
示例7: _notifications_signature
/**
* Signature for url parameters
*
* @param $params
* Ordered path elements
* @param $query
* Query string elements
*/
function _notifications_signature($params, $query = array())
{
$payload = implode('/', $params) . ':' . ($query ? notifications_array_serialize($query) : 'none');
return md5('notifications' . drupal_get_private_key() . ':' . $payload);
}