当前位置: 首页>>代码示例>>PHP>>正文


PHP UserTable::hashAndSaltPassword方法代码示例

本文整理汇总了PHP中CB\Database\Table\UserTable::hashAndSaltPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP UserTable::hashAndSaltPassword方法的具体用法?PHP UserTable::hashAndSaltPassword怎么用?PHP UserTable::hashAndSaltPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CB\Database\Table\UserTable的用法示例。


在下文中一共展示了UserTable::hashAndSaltPassword方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formatCondition


//.........这里部分代码省略.........
									$input					=	str_replace( $matches[0], ( $options->has( 'characters' ) ? trim( $value, $options->get( 'characters', null, GetterInterface::STRING ) ) : trim( $value ) ), $input );
									break;
							}
							break;
						case 'encode':
							switch( $method ) {
								case 'cslashes':
									$input					=	str_replace( $matches[0], addcslashes( $value, $options->get( 'characters', null, GetterInterface::STRING ) ), $input );
									break;
								case 'slashes':
									$input					=	str_replace( $matches[0], addslashes( $value ), $input );
									break;
								case 'entity':
									$input					=	str_replace( $matches[0], htmlentities( $value ), $input );
									break;
								case 'html':
									$input					=	str_replace( $matches[0], htmlspecialchars( $value ), $input );
									break;
								case 'url':
									$input					=	str_replace( $matches[0], urlencode( $value ), $input );
									break;
								case 'base64':
									$input					=	str_replace( $matches[0], base64_encode( $value ), $input );
									break;
								case 'md5':
									$input					=	str_replace( $matches[0], md5( $value ), $input );
									break;
								case 'sha1':
									$input					=	str_replace( $matches[0], sha1( $value ), $input );
									break;
								case 'password':
									$user					=	new UserTable();

									$input					=	str_replace( $matches[0], $user->hashAndSaltPassword( $value ), $input );
									break;
							}
							break;
						case 'decode':
							switch( $method ) {
								case 'cslashes':
									$input					=	str_replace( $matches[0], stripcslashes( $value ), $input );
									break;
								case 'slashes':
									$input					=	str_replace( $matches[0], stripslashes( $value ), $input );
									break;
								case 'entity':
									$input					=	str_replace( $matches[0], html_entity_decode( $value ), $input );
									break;
								case 'html':
									$input					=	str_replace( $matches[0], htmlspecialchars_decode( $value ), $input );
									break;
								case 'url':
									$input					=	str_replace( $matches[0], urldecode( $value ), $input );
									break;
								case 'base64':
									$input					=	str_replace( $matches[0], base64_encode( $value ), $input );
									break;
							}
							break;
						default:
							if ( ! $function ) {
								continue;
							}

							$class							=	$options->get( 'class', null, GetterInterface::STRING );
							$subFunction					=	null;
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:67,代码来源:cbautoactions.php

示例2: execute

	/**
	 * @param cbautoactionsActionTable $trigger
	 * @param UserTable $user
	 */
	public function execute( $trigger, $user )
	{
		global $_CB_framework, $_PLUGINS, $ueConfig;

		$params						=	$trigger->getParams()->subTree( 'registration' );

		$approve					=	(int) $params->get( 'approve', null, GetterInterface::INT );
		$confirm					=	(int) $params->get( 'confirm', null, GetterInterface::INT );
		$approval					=	( $approve == 2 ? $ueConfig['reg_admin_approval'] : $approve );
		$confirmation				=	( $confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm );
		$usergroup					=	$params->get( 'usergroup', null, GetterInterface::STRING );
		$password					=	$trigger->getSubstituteString( $params->get( 'password', null, GetterInterface::STRING ) );
		$name						=	array();

		if ( ! $usergroup ) {
			$gids					=	array( $_CB_framework->getCfg( 'new_usertype' ) );
		} else {
			$gids					=	explode( '|*|', $usergroup );
		}

		cbArrayToInts( $gids );

		$newUser					=	new UserTable();

		$newUser->set( 'gids', $gids );
		$newUser->set( 'sendEmail', 0 );
		$newUser->set( 'registerDate', $_CB_framework->getUTCDate() );
		$newUser->set( 'username', $trigger->getSubstituteString( $params->get( 'username', null, GetterInterface::STRING ) ) );
		$newUser->set( 'firstname', $trigger->getSubstituteString( $params->get( 'firstname', null, GetterInterface::STRING ) ) );
		$newUser->set( 'middlename', $trigger->getSubstituteString( $params->get( 'middlename', null, GetterInterface::STRING ) ) );
		$newUser->set( 'lastname', $trigger->getSubstituteString( $params->get( 'lastname', null, GetterInterface::STRING ) ) );

		if ( $newUser->get( 'firstname' ) ) {
			$name[]					=	$newUser->get( 'firstname' );
		}

		if ( $newUser->get( 'middlename' ) ) {
			$name[]					=	$newUser->get( 'middlename' );
		}

		if ( $newUser->get( 'lastname' ) ) {
			$name[]					=	$newUser->get( 'lastname' );
		}

		$newUser->set( 'name', implode( ' ', $name ) );
		$newUser->set( 'email', $trigger->getSubstituteString( $params->get( 'email', null, GetterInterface::STRING ) ) );

		if ( $password ) {
			$newUser->set( 'password', $newUser->hashAndSaltPassword( $password ) );
		} else {
			$newUser->setRandomPassword();

			$newUser->set( 'password', $newUser->hashAndSaltPassword( $newUser->get( 'password' ) ) );
		}

		$newUser->set( 'registeripaddr', cbGetIPlist() );

		if ( $approval == 0 ) {
			$newUser->set( 'approved', 1 );
		} else {
			$newUser->set( 'approved', 0 );
		}

		if ( $confirmation == 0 ) {
			$newUser->set( 'confirmed', 1 );
		} else {
			$newUser->set( 'confirmed', 0 );
		}

		if ( ( $newUser->get( 'confirmed' ) == 1 ) && ( $newUser->get( 'approved' ) == 1 ) ) {
			$newUser->set( 'block', 0 );
		} else {
			$newUser->set( 'block', 1 );
		}

		foreach ( $params->subTree( 'fields' ) as $row ) {
			/** @var ParamsInterface $row */
			$field					=	$row->get( 'field', null, GetterInterface::STRING );

			if ( $field ) {
				$newUser->set( $field, $trigger->getSubstituteString( $row->get( 'value', null, GetterInterface::RAW ), false, $row->get( 'translate', false, GetterInterface::BOOLEAN ) ) );
			}
		}

		$_PLUGINS->trigger( 'onBeforeUserRegistration', array( &$newUser, &$newUser ) );

		if ( ! $newUser->store() ) {
			if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
				var_dump( CBTxt::T( 'AUTO_ACTION_REGISTRATION_FAILED', ':: Action [action] :: Registration failed to save. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $newUser->getError() ) ) );
			}

			return;
		}

		if ( ( $newUser->get( 'confirmed' ) == 0 ) && ( $confirmation != 0 ) ) {
			if ( ! $newUser->store() ) {
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:registration.php


注:本文中的CB\Database\Table\UserTable::hashAndSaltPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。