本文整理汇总了PHP中CUtil::i18n方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtil::i18n方法的具体用法?PHP CUtil::i18n怎么用?PHP CUtil::i18n使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtil
的用法示例。
在下文中一共展示了CUtil::i18n方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpgradeversion
/**
* Upgrade version method
*/
public function actionUpgradeversion()
{
// check is newest
$aryVersionData = $this->actionHasnew(true);
$isok = 0;
$data = array();
$msg = "";
try {
if ($aryVersionData['ISOK'] !== 1 || empty($aryVersionData['DATA']['v'])) {
throw new CModelException(CUtil::i18n('exception,version_upgrad_withoutUpgrad'));
}
// get up to version
$strVersion = $aryVersionData['DATA']['v'];
if (empty($strVersion)) {
throw new CModelException(CUtil::i18n('exception,version_upgrad_upgradFaild'));
}
if ($strVersion <= CUR_VERSION_NUM) {
throw new CModelException(CUtil::i18n('exception,version_upgrad_withoutUpgrad'));
}
// execute upgrade
$command = SUDO_COMMAND . "cd " . WEB_ROOT . ";" . SUDO_COMMAND . "wget " . MAIN_DOMAIN . "/down/v{$strVersion}.zip;" . SUDO_COMMAND . "unzip -o v{$strVersion}.zip;" . SUDO_COMMAND . "rm -rf v{$strVersion}.zip;";
exec($command);
$isok = 1;
} catch (CModelException $e) {
$msg = $e->getMessage();
} catch (CException $e) {
$msg = NBT_DEBUG ? $e->getMessage() : CUtil::i18n('exception,sys_error');
}
header('Content-Type: text/html; charset=utf-8');
echo $this->encodeAjaxData($isok, $data, $msg);
exit;
}
示例2: actionIndex
/**
* Index method
*/
public function actionIndex()
{
//检查是否登入
Nbt::app()->login->checkIsLogin();
$this->replaceSeoTitle(CUtil::i18n('controllers,monitor_index_seoTitle'));
$aryData = array();
$this->render('index', $aryData);
}
示例3: checkLogin
/**
* 用户信息
* @param string $strVerifyType 登入形式,例如输入密码登入 或者cookie登入
* @param array $aryUserInfo 传进来的用户数据
*
* @author zhangyi
* @date 2014-5-29
*/
public function checkLogin($aryData = array())
{
if (empty($aryData)) {
throw new CModelException(CUtil::i18n('exception,sys_error'));
}
$aryUserInfo = $this->getUserInfo();
//验证用户名和密码
return $aryUserInfo['uname'] === $aryData['uname'] && $aryUserInfo['pwd'] === $aryData['pwd'];
}
示例4: run
/**
* 运行
*
*/
public function run()
{
if (empty($this->id)) {
throw new CException("CWidget->id " . CUtil::i18n('framework,cwidgetDialog_run_undefined'));
}
if (empty($this->triggerId)) {
throw new CException("CWidget->triggerId " . CUtil::i18n('framework,cwidgetDialog_run_undefined'));
}
if (empty($this->url)) {
throw new CException("CWidget->url " . CUtil::i18n('framework,cwidgetDialog_run_undefined'));
}
$aryData = array();
$this->render('dialog', $aryData);
}
示例5: init
/**
* init
*
*/
public function init()
{
parent::init();
//check is login
if ($this->isRequiredLogin && Nbt::app()->user->userId <= 0) {
//ajax请求,输出ajax格式信息
if (Nbt::app()->request->isAjaxRequest) {
echo $this->encodeAjaxData(false, array(), CUtil::i18n('controllers,user_login_notLogin'));
exit;
} else {
$url = Nbt::app()->request->getUrl();
$this->redirect(array('login', 'gourl' => urlencode($url)));
}
}
}
示例6: actionLogin
/**
* Index method
*/
public function actionLogin()
{
$objLoginModel = LoginModel::model();
try {
//检查是否是post请求
$boolCheckLogin = false;
if (Nbt::app()->request->isPostRequest) {
// 绑定数据
$aryUserInfo['uname'] = isset($_POST['uname']) ? htmlspecialchars(trim($_POST['uname'])) : '';
$aryUserInfo['pwd'] = isset($_POST['pwd']) ? CString::encodeMachinePassword(trim($_POST['pwd'])) : '';
$strIsRemember = isset($_POST['remember']) ? htmlspecialchars(trim($_POST['remember'])) : 'no';
// 检查登录
$boolCheckLogin = LoginModel::model()->checkLogin($aryUserInfo);
if ($boolCheckLogin === false) {
throw new CModelException(CUtil::i18n('controllers,login_index_pwdWrong'));
}
//根据是否登入成功,再判断是否将用户名和密码写入cookie
if ($boolCheckLogin === true && $strIsRemember === 'yes') {
$aryUserInfo['pwd'] = CString::encode($aryUserInfo['pwd'], UKEY);
//设置cookie,时间为一年
setcookie($this->_cookeName, base64_encode(json_encode($aryUserInfo)), time() + 365 * 24 * 3600);
}
} else {
if (!empty($_COOKIE[$this->_cookeName]) && $boolCheckLogin === false) {
$aryUserInfo = json_decode(base64_decode($_COOKIE[$this->_cookeName]), 1);
$aryUserInfo['pwd'] = CString::decode($aryUserInfo['pwd'], UKEY);
if (($boolCheckLogin = $objLoginModel->checkLogin($aryUserInfo)) === false) {
throw new CModelException(CUtil::i18n('controllers,login_index_pwdWrong'));
}
}
}
//contains/判断是否登入成功
if ($boolCheckLogin === true) {
Nbt::app()->session->set('userInfo', $aryUserInfo);
UtilMsg::saveTipToSession(CUtil::i18n('controllers,login_index_success'));
$this->redirect(array('index/index'));
}
} catch (CModelException $e) {
UtilMsg::saveErrorTipToSession($e->getMessage());
}
$this->layout = 'login';
$this->seoTitle = CUtil::i18n('controllers,login_index_seoTitle');
//根据key判断文件是否存在,如果不存在则)创建一个默认账户
$objLoginModel->createDefaultUserInfo();
$this->render('login', array('aryData' => $aryUserInfo));
}
示例7: actionSpeedData
/**
* 获取矿机数据
*
* @author zhangyi
* @date 2014-6-5
*/
public function actionSpeedData()
{
$isOk = 0;
$msg = '';
$aryData = array();
try {
$objSpeedModel = SpeedModel::model();
/*
if( Nbt::app() -> request -> isAjaxRequest )
{
*/
$aryData = $objSpeedModel->getSpeedDataByFile();
$strMode = '';
// If Sfards 3301 chip
if (strpos(SYS_INFO, 'SF3301') === 0) {
$strMode = 'sf';
}
//如果数据不存在,则刷新一次数据
if (empty($aryData) && $objSpeedModel->refreshSpeedData($strMode) === true) {
$aryData = $objSpeedModel->getSpeedDataByFile();
}
//如果数据依然不存在,则抛出系统异常错误
if (!empty($aryData)) {
$aryTemp['L'] = array_values($aryData['L']);
$aryTemp['B'] = array_values($aryData['B']);
$aryData = $aryTemp;
unset($aryTemp);
$isOk = 1;
} else {
throw new CModelException(CUtil::i18n('exception,sys_error'));
}
/*
}
else
{
throw new CModelException( CUtil::i18n('exception,sys_error') );
}
*/
} catch (CModelException $e) {
$msg = $e->getMessage();
}
echo $this->encodeAjaxData($isOk, $aryData, $msg);
exit;
}
示例8: render
/**
* display view.
*
* @param string $_viewFile_
* @param array|string $_data_
* @param bool $_return_
* @return string
*/
public function render($_viewFile_, $_data_ = null)
{
// we use special variable names here to avoid conflict when extracting data
if (is_array($_data_)) {
extract($_data_, EXTR_PREFIX_SAME, 'data');
} else {
$data = $_data_;
}
$_viewFile_1 = NBT_PATH . "/widget/views/{$_viewFile_}.php";
$_viewFile_2 = NBT_APPLICATION_PATH . "/libs/widgets/views/{$_viewFile_}.php";
if (file_exists($_viewFile_1) || file_exists($_viewFile_2)) {
if (file_exists($_viewFile_1)) {
require $_viewFile_1;
}
if (file_exists($_viewFile_2)) {
require $_viewFile_2;
}
} else {
throw new CException(CUtil::i18n('exception,view_notFound') . $_viewFile_);
}
}
示例9: init
/**
* 初始化
*
*/
public function init()
{
parent::init();
$this->filetypesDescription = CUtil::i18n('framework,cwidgetSwfupload_filetypes');
}
示例10: renderChangeImageLink
/**
* 输出更换验证码的链接
*
*/
public function renderChangeImageLink()
{
echo '<span id="jqChangeCaptcha">' . CUtil::i18n('framework,cwidgetCaptcha_imageLink_change') . '</span>';
$url = Nbt::app()->createUrl('captcha/index');
echo '<script>$(function(){ $("#jqChangeCaptcha").click(function(){ $("#jqCaptcha").attr("src","' . $url . (REWRITE_MODE === true ? '?' : '&') . 'random="+Math.random()); }); });</script>';
}
示例11:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title><?php
echo CUtil::i18n('vlayout,btc&Ltc_setting');
?>
</title>
<link href="<?php
echo $this->baseUrl;
?>
css/index.css" rel="StyleSheet" type="text/css">
<script src="<?php
echo $this->baseUrl;
?>
js/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<?php
echo $content;
?>
</body>
</html>
示例12: upload
/**
* 上传
*
*/
public function upload()
{
//属性校验
if (empty($this->_fileUploadName)) {
throw new CException(CUtil::i18n('exception,exec_set_notSet'));
}
if (empty($this->_intMaxSize)) {
throw new CException(CUtil::i18n('exception,exec_file_noSetloadSize'));
}
if (empty($this->_aryAllowedExtension)) {
throw new CException(CUtil::i18n('exception,exec_file_noSetUploadType'));
}
if (empty($this->_fileAbsPath)) {
throw new CException(CUtil::i18n('exception,exec_file_noSetUploadFixedAds'));
}
if (empty($this->_fileSavePath)) {
throw new CException(CUtil::i18n('exception,exec_file_noSetUploadAds'));
}
//PHP上传环境大小校验
$POST_MAX_SIZE = ini_get('post_max_size');
$unit = strtoupper(substr($POST_MAX_SIZE, -1));
$multiplier = $unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1));
$intSysMaxsize = $multiplier * (int) $POST_MAX_SIZE;
if ((int) $_SERVER['CONTENT_LENGTH'] > $intSysMaxsize && $POST_MAX_SIZE) {
throw new CException(CUtil::i18n('exception,exec_file_sizeCannotExceed') . $intSysMaxsize . $unit);
}
if (!isset($_FILES[$this->_fileUploadName])) {
throw new CException(CUtil::i18n('exception,exec_upload_FileNotFound') . $_FILES['.$this->_fileUploadName.']);
}
//上传错误
$FILE = $_FILES[$this->_fileUploadName];
if (isset($FILE["error"]) && $FILE["error"] != 0) {
throw new CException($this->_aryUploadError[$FILE['error']]);
}
//临时文件不是一个合法的上传文件
if (!isset($FILE["tmp_name"]) || !@is_uploaded_file($FILE["tmp_name"])) {
throw new CException(CUtil::i18n('exception,exec_file_fileIllegal'));
}
if (!isset($FILE['name'])) {
throw new CException('$_FILE' . CUtil::i18n('exception,exec_sys_none') . 'name');
}
//校验上传文件大小
$intFileSize = @filesize($FILE["tmp_name"]);
if (!$intFileSize || $intFileSize > $this->_intMaxSize) {
throw new CModelException(CUtil::i18n('exception,exec_file_sizeExceedMaxSize'));
}
if ($intFileSize <= 0) {
throw new CModelException(CUtil::i18n('exception,exec_file_tooSmallFile'));
}
//文件名校验
/*$strFileName = preg_replace('/[^'.$this->_strAllowedFileName.']|\.+$/i', "", basename($FILE['name']));
if (strlen( $strFileName ) == 0 || strlen( $strFileName ) > $this->_intMaxFileName )
throw new CModelException( "文件名长度太长了,不要超过{$this->_intMaxFileName}位" );*/
//文件类型校验
$aryPathInfo = pathinfo($FILE['name']);
$aryPathInfo['extension'] = strtolower(trim($aryPathInfo['extension']));
if (!in_array($aryPathInfo['extension'], $this->_aryAllowedExtension)) {
throw new CModelException(CUtil::i18n('exception,exec_file_allowedTypes') . implode(',', $this->_aryAllowedExtension));
}
//得到完整的文件保存路径【拼接文件扩展名】
$this->_fileSavePath .= ".{$aryPathInfo['extension']}";
$savefilepath = "{$this->_fileAbsPath}{$this->_fileSavePath}";
//创建目录
$arySavePathInfo = pathinfo($savefilepath);
if (!file_exists($arySavePathInfo['dirname']) && !@mkdir($arySavePathInfo['dirname'], 0755, true)) {
throw new CException(CUtil::i18n('exception,exec_file_unTomkdir') . $arySavePathInfo['dirname']);
}
//保存文件到指定位置
if (!@move_uploaded_file($FILE["tmp_name"], $savefilepath)) {
throw new CModelException(CUtil::i18n('exception,exec_upload_Failed'));
}
$aryReturn = array();
$aryReturn['pathr'] = $this->_fileSavePath;
$aryReturn['patha'] = $savefilepath;
$aryReturn['extension'] = $aryPathInfo['extension'];
return $aryReturn;
}
示例13: actionCancelbind
/**
* Cancel bind
*/
public function actionCancelbind()
{
// Get key
$os = DIRECTORY_SEPARATOR == '\\' ? "windows" : "linux";
$mac_addr = new CMac($os);
$strRKEY = '';
if (file_exists(WEB_ROOT . '/js/RKEY.TXT')) {
$strRKEY = file_get_contents(WEB_ROOT . '/js/RKEY.TXT');
}
$boolResult = $this->generateRKEY();
if ($boolResult === true) {
$boolResult = $this->actionGeneratekey(true);
}
// send cancel bind request
UtilApi::callCancelbind(md5($mac_addr->mac_addr . '-' . $strRKEY));
if ($boolResult === true) {
UtilMsg::saveTipToSession(CUtil::i18n('exception,bound_cancel_success'));
} else {
UtilMsg::saveErrorTipToSession(CUtil::i18n('exception,bound_cancel_faild'));
}
$this->redirect(array('index/index'));
}
示例14:
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown">
<span id="langNow"><?php
echo CUtil::i18n('vlayout,languge');
?>
</span><b class="caret"></b>
</a>
<ul id="languageMenu" class="dropdown-menu">
<li>
<a data-lang="zh">简体中文</a>
</li>
<li>
<a data-lang="en">English</a>
</li>
</ul>
</li>
<li>
<a href="<?php
echo $this->createUrl('login/logout');
?>
"><?php
echo CUtil::i18n('vlayout,logout');
?>
</a>
</li>
</ul>
</div>
</div>
</div>
示例15: deleteFile
public function deleteFile($_strFileName = '')
{
if (empty($_strFileName)) {
throw new CModelException(CUtil::i18n('exception,exec_file_nameNotNull'));
}
if (file_exists($this->_store_url . $_strFileName)) {
return unlink($this->_store_url . $_strFileName);
} else {
return false;
}
}