本文整理汇总了PHP中vRequest::getHash方法的典型用法代码示例。如果您正苦于以下问题:PHP vRequest::getHash方法的具体用法?PHP vRequest::getHash怎么用?PHP vRequest::getHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vRequest
的用法示例。
在下文中一共展示了vRequest::getHash方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
//.........这里部分代码省略.........
// Bind Joomla userdata
if (!$user->bind($whiteDataToBind)) {
vmdebug('Couldnt bind data to joomla user');
//array('user'=>$user,'password'=>$data['password'],'message'=>$message,'newId'=>$newId,'success'=>false);
}
if ($new) {
// If user registration is not allowed, show 403 not authorized.
// But it is possible for admins and storeadmins to save
$usersConfig = JComponentHelper::getParams('com_users');
$cUser = JFactory::getUser();
if ($usersConfig->get('allowUserRegistration') == '0' and !vmAccess::manager('user')) {
tsmConfig::loadJLang('com_tsmart');
vmError(tsmText::_('com_tsmart_ACCESS_FORBIDDEN'));
return;
}
// Initialize new usertype setting
$newUsertype = $usersConfig->get('new_usertype');
if (!$newUsertype) {
$newUsertype = 2;
}
// Set some initial user values
$user->set('usertype', $newUsertype);
$user->groups[] = $newUsertype;
$date = JFactory::getDate();
$user->set('registerDate', $date->toSQL());
// If user activation is turned on, we need to set the activation information
$useractivation = $usersConfig->get('useractivation');
$doUserActivation = false;
if ($useractivation == '1' or $useractivation == '2') {
$doUserActivation = true;
}
if ($doUserActivation) {
jimport('joomla.user.helper');
$user->set('activation', vRequest::getHash(JUserHelper::genRandomPassword()));
$user->set('block', '1');
//$user->set('lastvisitDate', '0000-00-00 00:00:00');
}
}
$option = vRequest::getCmd('option');
// If an exising superadmin gets a new group, make sure enough admins are left...
if (!$new && $user->get('gid') != $gid && $gid == __SUPER_ADMIN_GID) {
if ($this->getSuperAdminCount() <= 1) {
vmError(tsmText::_('com_tsmart_USER_ERR_ONLYSUPERADMIN'));
return false;
}
}
if (isset($data['language'])) {
$user->setParam('language', $data['language']);
}
// Save the JUser object
if (!$user->save()) {
$msg = tsmText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $user->getError());
vmError($msg, $msg);
return false;
} else {
$data['name'] = $user->get('name');
$data['username'] = $user->get('username');
$data['email'] = $user->get('email');
$data['language'] = $user->get('language');
$data['editor'] = $user->get('editor');
}
$newId = $user->get('id');
$data['tsmart_user_id'] = $newId;
//We need this in that case, because data is bound to table later
$this->setUserId($newId);
//Save the VM user stuff
示例2: _checkCreateKeyFile
private static function _checkCreateKeyFile($date)
{
jimport('joomla.filesystem.file');
vmSetStartTime('check');
static $existingKeys = false;
$keyPath = self::_getEncryptSafepath();
if (!$existingKeys) {
$dir = opendir($keyPath);
if (is_resource($dir)) {
$existingKeys = array();
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
if (!is_dir($keyPath . DS . $file)) {
$ext = Jfile::getExt($file);
if ($ext == 'ini' and file_exists($keyPath . DS . $file)) {
$content = parse_ini_file($keyPath . DS . $file);
if ($content and is_array($content) and isset($content['unixtime'])) {
$key = $content['unixtime'];
unset($content['unixtime']);
$existingKeys[$key] = $content;
//vmdebug('Reading '.$keyPath .DS. $file,$content);
}
} else {
vmdebug('Resource says there is file, but does not exists? ' . $keyPath . DS . $file);
}
} else {
//vmdebug('Directory in they keyfolder? '.$keyPath .DS. $file);
}
} else {
//vmdebug('Directory in the keyfolder '.$keyPath .DS. $file);
}
}
} else {
static $warn = false;
if (!$warn) {
vmWarn('Key folder in safepath unaccessible ' . $keyPath);
}
$warn = true;
}
}
if ($existingKeys and is_array($existingKeys) and count($existingKeys) > 0) {
ksort($existingKeys);
if (!empty($date)) {
$key = '';
foreach ($existingKeys as $unixDate => $values) {
if ($unixDate - 30 >= $date) {
vmdebug('$unixDate ' . $unixDate . ' >= $date ' . $date);
continue;
}
vmdebug('$unixDate < $date');
//$usedKey = $values;
$key = $values['key'];
}
vmdebug('Use key file ', $key);
//include($keyPath .DS. $usedKey.'.php');
} else {
$usedKey = end($existingKeys);
$key = $usedKey['key'];
}
vmTime('my time', 'check');
return $key;
} else {
$usedKey = date("ymd");
$filename = $keyPath . DS . $usedKey . '.ini';
if (!JFile::exists($filename)) {
$token = vRequest::getHash(JUserHelper::genRandomPassword());
$salt = JUserHelper::getSalt('crypt-md5');
$hashedToken = md5($token . $salt);
$key = base64_encode($hashedToken);
$date = JFactory::getDate();
$today = $date->toUnix();
//$key = pack('H*',$key);
$content = ';<?php die(); */
[keys]
key = "' . $key . '"
unixtime = "' . $today . '"
date = "' . date("Y-m-d H:i:s") . '"
; */ ?>';
$result = JFile::write($filename, $content);
vmTime('my time', 'check');
return $key;
}
}
vmTime('my time', 'check');
//return pack('H*',$key);
}
示例3: emptyCartFromStorageSession
function emptyCartFromStorageSession($session_id, $order_number)
{
$conf = JFactory::getConfig();
$handler = $conf->get('session_handler', 'none');
$config['session_name'] = 'site';
$name = vRequest::getHash($config['session_name']);
$options['name'] = $name;
$sessionStorage = JSessionStorage::getInstance($handler, $options);
$delete = false;
// we remove the session for unsecure unserialized PHP version
$phpVersion = phpversion();
if (version_compare($phpVersion, '5.4.0') >= 0) {
if (version_compare($phpVersion, '5.4.38') == -1) {
$delete = true;
} else {
if (version_compare($phpVersion, '5.5.0') >= 0) {
if (version_compare($phpVersion, '5.5.22') == -1) {
$delete = true;
} else {
if (version_compare($phpVersion, '5.6.0') >= 0) {
if (version_compare($phpVersion, '5.6.6') == -1) {
$delete = true;
}
}
}
}
}
}
// The session store MUST be registered.
$sessionStorage->register();
if ($delete) {
$sessionStorage->write($session_id, NULL);
return;
}
// reads directly the session from the storage
$sessionStored = $sessionStorage->read($session_id);
if (empty($sessionStored)) {
return;
}
$sessionStorageDecoded = self::session_decode($sessionStored);
$vm_namespace = '__vm';
$cart_name = 'vmcart';
if (isset($sessionStorageDecoded[$vm_namespace])) {
// vm session is there
$vm_sessionStorage = $sessionStorageDecoded[$vm_namespace];
if (isset($vm_sessionStorage[$cart_name])) {
// vm cart session is there
unset($sessionStorageDecoded[$vm_namespace][$cart_name]);
//$sessionStorageDecoded[$vm_namespace][$cart_name] = json_encode ($cart);
$sessionStorageEncoded = self::session_encode($sessionStorageDecoded);
$sessionStorage->write($session_id, $sessionStorageEncoded);
//}
}
}
}
示例4: emptyCartFromStorageSession
function emptyCartFromStorageSession($session_id, $order_number)
{
$conf = JFactory::getConfig();
$handler = $conf->get('session_handler', 'none');
$config['session_name'] = 'site';
$name = vRequest::getHash($config['session_name']);
$options['name'] = $name;
$sessionStorage = JSessionStorage::getInstance($handler, $options);
// The session store MUST be registered.
$sessionStorage->register();
// reads directly the session from the storage
$sessionStored = $sessionStorage->read($session_id);
if (empty($sessionStored)) {
return;
}
$sessionStorageDecoded = self::session_decode($sessionStored);
$vm_namespace = '__vm';
$cart_name = 'vmcart';
if (isset($sessionStorageDecoded[$vm_namespace])) {
// vm session is there
$vm_sessionStorage = $sessionStorageDecoded[$vm_namespace];
if (isset($vm_sessionStorage[$cart_name])) {
// vm cart session is there
unset($sessionStorageDecoded[$vm_namespace][$cart_name]);
//$sessionStorageDecoded[$vm_namespace][$cart_name] = json_encode ($cart);
$sessionStorageEncoded = self::session_encode($sessionStorageDecoded);
$sessionStorage->write($session_id, $sessionStorageEncoded);
//}
}
}
}