本文整理汇总了PHP中DxdUtil::randCode方法的典型用法代码示例。如果您正苦于以下问题:PHP DxdUtil::randCode方法的具体用法?PHP DxdUtil::randCode怎么用?PHP DxdUtil::randCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DxdUtil
的用法示例。
在下文中一共展示了DxdUtil::randCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$storage = $cloudStorageForm->storage;
?>
<br />
<div id="dxd-for-self"
class="dxd-media-source <?php
if ($model->mediaSource != "self") {
echo 'dxd-hidden';
}
?>
">
<?php
if ($storage == 'cloud') {
$cloudService = CloudService::getInstance("uploads/uploadFile/lesson/mediaId/" . DxdUtil::randCode(32));
// $cloudService = new CloudService();
$this->widget('ext.uploadify.MUploadify', array('name' => 'file', 'buttonText' => '选择文件', 'auto' => true, 'uploader' => 'http://up.eduwind.com', 'formData' => array('token' => $cloudService->makeUploadToken(), 'key' => $cloudService->getKey()), 'onUploadSuccess' => "js:function(file, data, response) {\n\t\t\t \t\t\t\t\tdataObj = JSON.parse(data);\n\t\t\t \t\t\t\t\tif(data){\n\t\t\t \t\t\t\t\t\t\$('#uploaded-file-{$model->id}').html('<span style=\\'text-success\\'>“' + file.name + '</span>”已经上传成功。');\n\t\t\t \t\t\t\t\t\t\$.post('" . $this->createUrl('setMedia', array('lessonId' => $model->id)) . "',{name:file.name,mediaId:dataObj.id});\n\t\t\t\t\t\t\t\t\t}else{\n\t\t\t \t\t\t\t\t\t\$('#uploaded-file-{$model->id}').html('<span style=\\'text-error\\'>“' + file.name + '</span>”上传失败。');\n \t\t\t\t\t\t\t}\n\t\t\t\t\t}", 'onQueueComplete' => "js:function(queueData) {\n\t\t\t \$('div#file').addClass('dxd-hidden');\n\t\t\t }"));
// $this->widget('ext.uploadify.MUploadify',CloudService::getInstance("uploads/uploadFile/lesson/mediaId/".DxdUtil::randCode(32))->getUploadifySetting());
// CloudService::getInstance()->cloudService();
} else {
$this->widget('ext.uploadify.MUploadify', array('name' => 'file', 'buttonText' => '选择文件', 'uploader' => $this->createUrl('upload', array('lessonId' => $model->id)), 'auto' => true, 'onUploadSuccess' => "js:function(file, data, response) {\n\t\t\t \t\t\t\t\tif(data){\n\t\t\t \t\t\t\t\t\t\$('#uploaded-file-{$model->id}').html('<span style=\\'text-success\\'>“' + file.name + '</span>”已经上传成功。');\n\t\t\t \t\t\t\t\t}else{\n\t\t\t \t\t\t\t\t\t\$('#uploaded-file-{$model->id}').html('<span style=\\'text-error\\'>“' + file.name + '</span>”上传失败。');\n \t\t\t\t\t\t\t}\n\t\t\t\t\t }", 'onQueueComplete' => "js:function(queueData) {\n\t\t\t \$('div#file').addClass('dxd-hidden');\n\t\t\t }"));
}
// echo $form->hiddenField($model,'mediaId',array('id'=>'mediaId'));
?>
<!--
<div><pre><p id="uploadFileName" class="text-center text-info">还没有选择文件</p></pre></div>
-->
<br /> <em id='uploaded-file-<?php
echo $model->id;
?>
示例2: actionResetPassword
/**
* 重设密码
* Enter description here ...
* @param unknown_type $resetPassword
* @param unknown_type $email
*/
public function actionResetPassword($resetPassword, $email)
{
$model = User::model()->findByAttributes(array('email' => urldecode($email), 'resetPassword' => $resetPassword));
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
$model->resetPassword = DxdUtil::randCode(32);
if ($model->save()) {
Yii::app()->user->setFlash('success', Yii::t('app', '密码重设成功'));
$this->redirect('login');
} else {
Yii::app()->user->setFlash('error', Yii::t('app', '抱歉,密码重设失败!'));
}
}
$this->render('resetPassword', array('model' => $model));
}
示例3: array
if ($model->file) {
echo "已上传文件:" . $model->file->name;
}
?>
<br/><?php
echo "最大允许上传文件" . $maxFileSize . "M";
?>
<?php
echo CHtml::link('如何修改?', "http://eduwind.com/index.php?r=group/post&id=33", array('target' => '_blank'));
?>
-->
<?php
if ($storage == 'cloud') {
$this->widget('ext.uploadify.MUploadify', CloudService::getInstance("uploads/uploadFile/lesson/mediaId/" . DxdUtil::randCode(32))->getUploadifySetting());
} else {
$this->widget('ext.uploadify.MUploadify', array('name' => 'file', 'buttonText' => '选择文件', 'uploader' => $this->createUrl('lesson/uploadVideo', array('courseId' => $model->courseId)), 'auto' => true, 'onUploadSuccess' => "js:function(file, data, response) {\n\t\t\t \t\t\t\t\tdataObj = JSON.parse(data);\n\t\t\t \t\t\t\t\t\$('input#mediaId').val(dataObj.id);\n\t\t\t \t\t\t\t\t\$('p#uploadFileName').html('文件“' + file.name + '”已经上传成功。<a id=\"reUpload\" href=\"javaScript:void(0)\">重新上传</a>');\n\t\t\t \t\t\t\t\t\$('.uploadify').uploadify('settings','buttonText','再次上传');\n\t\t\t\t\t }", 'onQueueComplete' => "js:function(queueData) {\n\t\t\t \$('div#file').addClass('dxd-hidden');\n\t\t\t }"));
}
echo $form->hiddenField($model, 'mediaId', array('id' => 'mediaId'));
?>
<div><pre><p id="uploadFileName" class="text-center text-info">还没有选择文件</p></pre></div>
</div>
<div id="dxd-for-link" class="dxd-media-source <?php
if ($model->mediaSource == "self") {
echo 'dxd-hidden';
}
?>
">
示例4: actionRennAuth
/**
* 处理人人网登录事宜
* Enter description here ...
* @throws CHttpException
*/
public function actionRennAuth()
{
$rennService = new RennService();
$rennClient = $rennService->getClient();
// 处理code -- 根据code来获得token
if (isset($_REQUEST['code'])) {
$keys = array();
// 获得code
$keys['code'] = $_REQUEST['code'];
$keys['redirect_uri'] = Yii::app()->createAbsoluteUrl('/oauth/rennAuth');
try {
// 根据code来获得token
$token = $rennClient->getTokenFromTokenEndpoint('code', $keys);
} catch (RennException $e) {
error_log($e->getTraceAsString());
throw new CHttpException(403, Yii::t('app', '没有得到授权,不能访问'));
Yii::app()->end();
}
}
// 获得用户接口
$userService = $rennClient->getUserService();
// 获得当前登录的人人用户信息
try {
$rennUser = $userService->getUserLogin();
} catch (Exception $e) {
throw new CHttpException(403, Yii::t('app', '没有得到授权,不能访问'));
Yii::app()->end();
}
if (isset($rennUser)) {
//检查是否为新用户
// $rrOauth = Oauth::model()->find('rrid=:rrid',array('rrid'=>$rennUser['id']));
$userInfo = UserInfo::model()->findByAttributes(array('rennId' => $rennUser['id']));
//如果是新用户,在站内创建一个对应用户
if (!$userInfo) {
$transaction = Yii::app()->db->beginTransaction();
try {
$user = new User();
$user->email = 'RRId' . $rennUser['id'] . '@daxidao.com';
$user->password = DxdUtil::randCode(32);
$user->salt = DxdUtil::randCode(32);
$userSaved = $user->validate() && $user->save();
$userInfo = new UserInfo();
$userInfo->id = $user->getPrimaryKey();
$userInfo->email = $user->email;
$userInfo->name = $rennUser['name'];
$userInfo->addTime = time();
$userInfo->rennId = $rennUser['id'];
$userInfo->status = 'ok';
$userInfoSaved = $userInfo->save();
if (!$userSaved || !$userInfoSaved) {
Yii::app()->user->setFlash('error', Yii::t('app', '抱歉,创建用户失败'));
throw new Exception(Yii::t('app', '创建用户失败!'));
}
$transaction->commit();
} catch (Exception $e) {
$transaction->rollback();
$this->redirect(Yii::app()->baseUrl);
Yii::app()->end();
}
}
//站内用户登录
/* $identity=new UserIdentity($userInfo->email,'somepassword');
$identity->authenticate(true);
if($identity->errorCode===UserIdentity::ERROR_NONE)
{
//$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
Yii::app()->user->login($identity, 0);
//print_r(Yii::app()->user);
}*/
$user = User::model()->findByAttributes(array('email' => $userInfo->email));
$user->loginWithoutPassword();
}
//如果还没有填写email
if ($userInfo->noEmail()) {
$this->redirect(array('u/registerOauth'));
Yii::app()->end();
}
Yii::app()->user->setFlash('success', Yii::t('app', '人人网登录成功!'));
$this->redirect($this->homePage);
}