本文整理汇总了PHP中zmf::filterInput方法的典型用法代码示例。如果您正苦于以下问题:PHP zmf::filterInput方法的具体用法?PHP zmf::filterInput怎么用?PHP zmf::filterInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zmf
的用法示例。
在下文中一共展示了zmf::filterInput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView($id)
{
$id = zmf::filterInput($id);
$info = $this->loadModel($id);
if ($info['redirect'] > 0) {
$this->redirect(array('position/view', 'id' => $info['redirect']));
}
$_title = '';
if ($info['title_cn'] != '') {
$_title = $info['title_cn'];
}
if ($info['title_en'] != '' && $_title != '') {
$_title .= '(' . $info['title_en'] . ')';
} elseif ($info['title_local'] && $_title != '') {
$_title .= '(' . $info['title_local'] . ')';
} elseif ($info['title_en'] != '') {
$_title .= $info['title_en'];
} else {
$_title .= $info['title_local'];
}
$_address = '';
if ($info['address_cn'] != '') {
$_address = $info['address_cn'];
} elseif ($info['address_en'] != '') {
$_address = $info['address_en'];
} else {
$_address = $info['address_local'];
}
if (!Yii::app()->user->isGuest) {
if (Favorites::checkFavored($id, 'poi')) {
$this->favorited = true;
}
$tipinfo = PoiPost::model()->findByAttributes(array('logid' => $id, 'uid' => Yii::app()->user->id), 'status=' . Posts::STATUS_PASSED);
if ($tipinfo) {
$this->tiped = $tipinfo;
}
}
$info->faceimg = Attachments::faceImg($info, 600);
//获取图片
$images = Attachments::model()->findAll(array('condition' => "logid=:id AND " . ($info['faceimg'] > 0 ? "id!=" . $info['faceimg'] . ' AND ' : '') . " classify='poi' AND status=" . Posts::STATUS_PASSED, 'select' => 'id,filePath,classify,cTime', 'limit' => 6, 'order' => 'favor DESC', 'params' => array(':id' => $id)));
$breads = array();
$breads[] = CHtml::link('目的地', array('position/index'));
if ($info['areaid']) {
$areaInfo = Area::model()->findByPk($info['areaid']);
if ($areaInfo) {
$breads[] = CHtml::link($areaInfo['title'], array('position/index', 'areaid' => $areaInfo['id']));
}
}
//获取购买地址
$buylinks = array();
if ($info['classify'] == Position::HOTEL) {
$buylinks = Buylink::getAll('poi', $info->id);
}
//更新访问统计
Posts::updateCount($id, 'Position');
$breads[] = $_title;
$this->pageTitle = $_title . ' - ' . zmf::config('sitename');
$this->pageDescription = '【' . $_title . '】位于' . $_address . ',' . zmf::subStr($info['content'], 200);
$this->render('view', array('info' => $info, 'type' => $type, 'breads' => $breads, 'buylinks' => $buylinks, 'images' => $images));
}
示例2: addAds
public static function addAds($uid)
{
if (!$uid) {
return false;
}
$model = new Ads();
$thekeyid = zmf::filterInput($_POST['Ads']['id']);
$attachid = zmf::filterInput($_POST['Ads']['attachid'], 't', 1);
$intoData = $_POST['Ads'];
$intoData['attachid'] = $attachid;
$intoData['status'] = 1;
$intoData['uid'] = $uid;
if (isset($intoData['start_time'])) {
$intoData['start_time'] = strtotime($intoData['start_time']);
}
if (isset($intoData['expired_time'])) {
$intoData['expired_time'] = strtotime($intoData['expired_time']);
}
$model->attributes = $intoData;
if ($model->validate()) {
if ($model->updateByPk($thekeyid, $intoData)) {
zmf::delFCache("notSaveAds{$uid}");
if ($attachid) {
Attachments::model()->updateAll(array('status' => Posts::STATUS_DELED), "logid={$thekeyid} AND uid={$uid} AND classify='ads'");
Attachments::model()->updateAll(array('status' => Posts::STATUS_PASSED), "id={$attachid}");
}
return true;
} else {
$info = $_POST['Ads'];
}
} else {
$info = $_POST['Ads'];
}
return $info;
}
示例3: findAndAdd
public static function findAndAdd($title, $classify, $logid)
{
$title = zmf::filterInput($title, 't', 1);
if (!$title) {
return false;
}
$info = Tags::model()->find('title=:title AND classify=:classify', array(':title' => $title, ':classify' => $classify));
if (!$info) {
if (Yii::app()->session['checkHasBadword'] == 'yes') {
$status = Posts::STATUS_STAYCHECK;
} else {
$status = Posts::STATUS_PASSED;
}
unset(Yii::app()->session['checkHasBadword']);
$_data = array('title' => $title, 'name' => zmf::pinyin($title), 'classify' => $classify, 'status' => $status, 'cTime' => time(), 'length' => mb_strlen($title, 'GBK'));
$modelB = new Tags();
$modelB->attributes = $_data;
if ($modelB->save()) {
$tagid = $modelB->id;
}
} else {
$tagid = $info['id'];
}
if ($tagid && $logid) {
$_info = TagRelation::model()->find('tagid=:tagid AND logid=:logid AND classify=:classify', array(':tagid' => $tagid, ':logid' => $logid, ':classify' => $classify));
if (!$_info) {
$_tagre = array('tagid' => $tagid, 'logid' => $logid, 'classify' => $classify, 'cTime' => zmf::now());
$modelC = new TagRelation();
$modelC->attributes = $_tagre;
$modelC->save();
}
}
return $tagid;
}
示例4: actionView
public function actionView($code)
{
$code = zmf::filterInput($code, 't', 1);
$info = SiteInfo::model()->find('code=:code', array(':code' => $code));
if (!$info) {
throw new CHttpException(404, '您所查看的页面不存在');
}
$allInfos = SiteInfo::model()->findAll(array('select' => 'code,title', 'condition' => 'status=' . Posts::STATUS_PASSED));
//更新访问统计
Posts::updateCount($info['id'], 'SiteInfo');
$data = array('info' => $info, 'allInfos' => $allInfos, 'code' => $code);
$this->pageTitle = $info['title'] . ' - ' . zmf::config('sitename');
$this->render('/site/siteinfo', $data);
}
示例5: actionManage
public function actionManage()
{
$id = zmf::filterInput($_POST['id']);
if (!Yii::app()->request->isAjaxRequest) {
Admin::jsonOutPut(0, '不允许的操作');
}
if (!isset($id) or !is_numeric($id)) {
Admin::jsonOutPut(0, '缺少参数');
}
$status = Feedback::STATUS_CHECKED;
if (Feedback::model()->updateByPk($id, array('status' => $status))) {
Admin::jsonOutPut(1, '操作成功!');
} else {
Admin::jsonOutPut(0, '操作失败');
}
}
示例6: actionUpdate
public function actionUpdate($type)
{
if (!in_array($type, array('info', 'passwd'))) {
$this->message(0, '您的操作有误');
}
if (isset($_POST) and !empty($_POST)) {
$model = new Users();
if ($type == 'info') {
$intoData['truename'] = zmf::filterInput($_POST['truename'], 't', 1);
if (!$intoData['truename']) {
$this->message(0, '用户名不能为空');
}
//如果用户修改了用户名,则判断是否被使用
if ($intoData['truename'] != $this->userInfo['truename']) {
$info = Users::getInfoByName($intoData['truename']);
if ($info) {
$this->message(0, '该用户名已被使用');
}
}
$intoData['url'] = zmf::filterInput($_POST['url'], 't', 1);
$intoData['desc'] = zmf::filterInput($_POST['desc'], 't', 1);
} elseif ($type == 'passwd') {
$old = zmf::filterInput($_POST['old_password'], 't', 1);
$info = Users::model()->findByPk($this->uid);
if (!$old) {
$this->message(0, '请输入原始密码');
} elseif (md5($old) != $info['password']) {
$this->message(0, '原始密码不正确');
}
if (!$_POST['password']) {
$this->message(0, '请输入密码');
} elseif (strlen($_POST['password']) < 5) {
$this->message(0, '新密码过短,请重新输入');
}
$intoData['password'] = md5($_POST['password']);
}
if ($model->updateByPk($this->uid, $intoData)) {
$this->message(1, '修改成功', Yii::app()->createUrl('users/index'));
} else {
$this->message(1, '修改成功', Yii::app()->createUrl('users/index'));
}
}
$data = array('info' => $this->userInfo, 'type' => $type);
$this->render('update', $data);
}
示例7: actionAdd
public function actionAdd()
{
$this->checkPower('setConfig');
$type = zmf::filterInput($_POST['type'], 't', 1);
if ($type == '' or !in_array($type, array('baseinfo', 'upload', 'base', 'email'))) {
$type = 'baseinfo';
}
unset($_POST['type']);
unset($_POST['YII_CSRF_TOKEN']);
$configs = $_POST;
if (!empty($configs)) {
foreach ($configs as $k => $v) {
if (is_array($v)) {
$v = join(',', $v);
}
//组织出hash,根据变量、变量的值及分类的md5
$_hash = md5($k . $v . $type);
//如果能找到hash则说明该设置未变化
$_configInfo = Config::model()->find('`hash`=:hash', array(':hash' => $_hash));
if (!$_configInfo) {
//没找到说明已更改或者不存在该设置
//根据name和classify判断是否有该设置,没有则新增,有则更新
$_detailInfo = Config::model()->find('`name`=:name AND classify=:type', array(':name' => $k, ':type' => $type));
if (!$_detailInfo) {
//新增
$data = array('name' => zmf::filterInput($k, 't'), 'value' => zmf::filterInput($v, 't'), 'classify' => zmf::filterInput($type, 't'), 'hash' => $_hash);
$model = new Config();
$model->attributes = $data;
$model->save();
} else {
//更新
Config::model()->updateByPk($_detailInfo['id'], array('value' => zmf::filterInput($v, 't'), 'hash' => $_hash));
}
} else {
//未做变化,不操作
}
}
}
//更新本地配置缓存
$_c = Config::model()->findAll();
$configs = CHtml::listData($_c, 'name', 'value');
zmf::writeSet($configs);
$this->redirect(array('config/index', 'type' => $type));
}
示例8: actionIndex
/**
* 婚庆列表
*/
public function actionIndex()
{
$this->selectedType = zmf::filterInput($_GET['type']);
if (!$this->selectedType || !in_array($this->selectedType, array('1', '2'))) {
$this->selectedType = '1';
}
if ($this->selectedType == 1) {
//用户
$criteria = new CDbCriteria();
$criteria->condition = 'classify=' . Users::USER_CLASSIFY_WEDDING;
$criteria->select = 'id,truename,avatar,sex,tagids,content';
// $criteria->order = 'cTime DESC';
$count = Users::model()->count($criteria);
$pager = new CPagination($count);
$pager->pageSize = 30;
$pager->applyLimit($criteria);
$posts = Users::model()->findAll($criteria);
if (!empty($posts)) {
foreach ($posts as $k => $val) {
$posts[$k]['avatarImg'] = Users::getAvatar($val['avatar']);
$posts[$k]['tagids'] = Tags::getByIds($val['tagids']);
}
}
} elseif ($this->selectedType == 2) {
//团队
$criteria = new CDbCriteria();
$criteria->order = 'cTime DESC';
$count = WeddingGroup::model()->count($criteria);
$pager = new CPagination($count);
$pager->pageSize = 30;
$pager->applyLimit($criteria);
$posts = WeddingGroup::model()->findAll($criteria);
if (!empty($posts)) {
foreach ($posts as $k => $val) {
$posts[$k]['avatar'] = Users::getAvatar($val['avatar']);
}
}
}
//面包屑
$breads[] = CHtml::link('婚庆', array('group/index'));
$this->pageTitle = '婚礼人 - ' . zmf::config('sitename');
$this->render('index', array('pages' => $pager, 'posts' => $posts, 'breads' => $breads));
}
示例9: actionView
public function actionView($id)
{
$id = zmf::filterInput($id);
if (!$id || !is_numeric($id)) {
throw new CHttpException(404, '你所查看的页面不存在.');
}
$info = Naodong::model()->findByPk($id);
if ($info == NULL) {
throw new CHttpException(404, '你所查看的页面不存在.');
}
//更新访问次数
Posts::updateCount($id, 'Naodong');
//获取评论列表
$sql = "SELECT * FROM {{comments}} WHERE logid='{$id}' AND classify='naodong' AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime ASC";
Posts::getAll(array('sql' => $sql, 'pageSize' => 2), $pages, $comLists);
//获取上下篇
$preInfo = Naodong::model()->find(array('condition' => 'id>:id AND status=' . Posts::STATUS_PASSED, 'select' => 'id,title', 'params' => array(':id' => $id)));
$nextInfo = Naodong::model()->find(array('condition' => 'id<:id AND status=' . Posts::STATUS_PASSED, 'select' => 'id,title', 'params' => array(':id' => $id)));
$authorInfo = $recommends = array();
if ($info['uid']) {
//获取作者信息
$authorInfo = Users::getUserInfo($info['uid']);
//获取作者相关推荐
$recommends = Naodong::getRecommends($info['uid'], $id);
}
//获取是否赞过
if ($this->uid) {
if (UserAction::checkAction($id, 'favorNaodong')) {
$this->favored = true;
}
}
$data = array('info' => $info, 'posts' => $comLists, 'pages' => $pages, 'userInfo' => $authorInfo, 'recommends' => $recommends, 'preInfo' => $preInfo, 'nextInfo' => $nextInfo);
$this->pageTitle = $info['title'] . ' - ' . zmf::config('sitename');
$this->pageDescription = zmf::subStr($info['content'], 140);
$this->mobileTitle = $authorInfo['truename'];
$this->render('/index/view', $data);
}
示例10: getValue
/**
* 根据名称返回$_GET或$_POST的数据
* @param type $key
* @param type $notEmpty
* @param type $ttype
* @param type $textonly 0富文本,1纯文本,2数字,默认纯文本
* @return type
*/
public function getValue($key, $notEmpty = false, $textonly = 1, $decode = 0)
{
$return = zmf::filterInput($_GET[$key], $textonly);
$arr = array('uid' => '作者ID', 'content' => '内容', 'type' => '类型', 'token' => '请求错误,请退出应用并重新启动');
if ($notEmpty) {
if (empty($return)) {
$_info = $arr[$key];
if (!$_info) {
$_info = $key;
}
self::output('[' . $_info . ']不能为空', $this->errorCode);
}
}
return $return;
}
示例11: actionDelPost
/**
* 删除内容
*/
public function actionDelPost()
{
$logid = zmf::filterInput($_POST['logid']);
$type = zmf::filterInput($_POST['type'], 't', 1);
$admin = false;
if (empty($logid) or !is_numeric($logid)) {
$this->jsonOutPut(0, Yii::t('default', 'unkownerror'));
}
if (!Yii::app()->request->isAjaxRequest) {
//Forbidden::updateTimes();
$this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
}
if (Yii::app()->user->isGuest) {
$this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
}
if (!in_array($type, array('naodong', 'comment', 'notice'))) {
$this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
}
if ($type == 'naodong') {
$tinfo = Naodong::model()->findByPk($logid);
if (!$tinfo) {
$this->jsonOutPut(0, Yii::t('default', 'pagenotexists'));
} elseif ($tinfo['uid'] != zmf::uid()) {
// $admin = Users::checkPower('delpost', false, true);
// if (!$admin) {
// $this->jsonOutPut(0, '请勿越权操作');
// }
}
$status = Posts::STATUS_DELED;
$attr = array('status' => Posts::STATUS_DELED);
if (Naodong::model()->updateByPk($logid, $attr)) {
$this->jsonOutPut(1, '操作成功!');
} else {
$this->jsonOutPut(1, '操作失败!');
}
} elseif ($type == 'comment') {
$cinfo = Comments::model()->findByPk($logid);
if (!$cinfo) {
$this->jsonOutPut(0, Yii::t('default', 'pagenotexists'));
} elseif ($cinfo['uid'] != zmf::uid()) {
// $admin = Users::checkPower('delcomment', false, true);
// if (!$admin) {
// $this->jsonOutPut(0, '请勿越权操作');
// }
}
$status = Posts::STATUS_DELED;
$attr = array('status' => $status);
if (Comments::model()->updateByPk($logid, $attr)) {
if (strtolower($cinfo['classify']) == 'naodong') {
Posts::updateCount($cinfo['logid'], 'Naodong', -1, 'comments');
}
$this->jsonOutPut(1, '操作成功!');
} else {
$this->jsonOutPut(1, '操作失败!');
}
} elseif ($type == 'notice') {
$cinfo = Notification::model()->findByPk($logid);
if (!$cinfo) {
$this->jsonOutPut(0, Yii::t('default', 'pagenotexists'));
} elseif ($cinfo['uid'] != zmf::uid()) {
$this->jsonOutPut(0, '请勿越权操作');
}
if (Notification::model()->deleteByPk($logid)) {
$this->jsonOutPut(1, '操作成功!');
} else {
$this->jsonOutPut(0, '操作失败');
}
}
}
示例12: actionReg
public function actionReg()
{
if (!Yii::app()->user->isGuest) {
$this->message(0, '您已登录,请勿重复操作');
}
$model = new Users();
if (isset($_POST['ajax']) && $_POST['ajax'] === 'users-addUser-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
if (isset($_POST['Users'])) {
if (UserAction::checkRegTimes()) {
$this->message(0, '您今天的注册次数已用完');
}
$email = zmf::filterInput($_POST['Users']['email'], 't', 1);
$truename = zmf::filterInput($_POST['Users']['truename'], 't', 1);
$inputData = array('truename' => $truename, 'password' => $_POST['Users']['password'] != '' ? md5($_POST['Users']['password']) : '', 'email' => $email);
$model->attributes = $inputData;
if ($model->validate()) {
if ($model->save()) {
$_model = new LoginForm();
$_model->email = $email;
$_model->password = $_POST['Users']['password'];
$_model->login();
$this->referer = array('users/index', 'id' => Yii::app()->user->id);
$this->redirect($this->referer);
}
}
}
$data = array('model' => $model);
$this->pageTitle = '免费注册 - ' . zmf::config('sitename');
$this->render('addUser', $data);
}
示例13: val
/**
* 获取传参
* @param type $key,参数的键名
* @param type $ttype,传参类型,n:数字,t:文本
* @param type $textonly,是否纯文本
* @return boolean
*/
public static function val($key, $ttype = 'n', $textonly = 1)
{
$return = zmf::filterInput(Yii::app()->request->getParam($key), $ttype, $textonly);
return $return;
}
示例14: actionSimpleUpload
/**
* 不入数据库的上传
* 不做压缩和缩略图处理
*/
public function actionSimpleUpload()
{
$uptype = zmf::filterInput($_GET['type'], 't', 1);
$fileholder = zmf::filterInput($_GET['fileholder'], 't', 1);
//上传控件的ID
$fileName = zmf::filterInput($_GET['fileName'], 't', 1);
//上传后保存名字
$keyid = zmf::filterInput($_GET['keyid']);
//所属对象ID
if (!isset($uptype) or !in_array($uptype, array('topArea', 'avatar'))) {
$this->jsonOutPut(0, '请设置上传所属类型' . $uptype);
}
if (Yii::app()->request->getParam('PHPSESSID')) {
Yii::app()->session->close();
Yii::app()->session->setSessionID(Yii::app()->request->getParam('PHPSESSID'));
Yii::app()->session->open();
}
if (Yii::app()->user->isGuest) {
$this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
}
if ($uptype == 'avatar' && !$keyid) {
$this->jsonOutPut(0, '缺少参数');
}
$checkInfo = UserPower::check('addImage', true);
if (!$checkInfo['status']) {
$this->jsonOutPut(0, $checkInfo['msg']);
}
if (!$fileholder) {
$fileholder = 'filedata';
}
if (!isset($_FILES[$fileholder]) || !is_uploaded_file($_FILES[$fileholder]["tmp_name"]) || $_FILES[$fileholder]["error"] != 0) {
$this->jsonOutPut(0, '无效上传,请重试');
}
$img = CUploadedFile::getInstanceByName($fileholder);
$ext = $img->getExtensionName();
$size = $img->getSize();
if ($size > zmf::config('imgMaxSize')) {
$this->jsonOutPut(0, '上传文件最大尺寸为:' . tools::formatBytes(zmf::config('imgMaxSize')));
}
$upExt = zmf::config("imgAllowTypes");
if (!preg_match('/^(' . str_replace('*.', '|', str_replace(';', '', $upExt)) . ')$/i', $ext)) {
$this->jsonOutPut(0, '上传文件扩展名必需为:' . $upExt);
}
if (!$fileName) {
$fileName = uniqid() . '.' . $ext;
}
if ($uptype == 'avatar') {
$fileName = $keyid . '.jpg';
}
if ($uptype == 'topArea') {
$todir = zmf::attachBase('app') . '/daodao/';
$returnDir = zmf::attachBase('site') . '/daodao/';
} elseif ($uptype == 'avatar') {
$todir = zmf::attachBase('app') . '/avatar/origin/' . $keyid . '/';
$todir2 = zmf::attachBase('app') . '/avatar/big/' . $keyid . '/';
$todir3 = zmf::attachBase('app') . '/avatar/small/' . $keyid . '/';
$returnDir = zmf::attachBase('site') . '/avatar/small/' . $keyid . '/';
}
zmf::createUploadDir($todir);
if (move_uploaded_file($_FILES[$fileholder]["tmp_name"], $todir . $fileName)) {
if ($uptype == 'avatar') {
$image = Yii::app()->image->load($todir . $fileName);
zmf::createUploadDir($todir2);
zmf::createUploadDir($todir3);
$image->smart_resize(100, 100)->quality(95);
$image->save($todir2 . $fileName);
$image->smart_resize(50, 50)->quality(95);
$image->save($todir3 . $fileName);
}
$outPutData = array('status' => 1, 'imgsrc' => $returnDir . $fileName, 'attachid' => '');
$json = CJSON::encode($outPutData);
echo $json;
} else {
$this->jsonOutPut(0, '上传失败');
}
}
示例15: actionSimpleUpload
/**
* 不入数据库的上传
* 不做压缩和缩略图处理
*/
public function actionSimpleUpload()
{
$uptype = zmf::filterInput($_GET['type'], 't', 1);
$fileholder = zmf::filterInput($_GET['fileholder'], 't', 1);
//上传控件的ID
$fileName = zmf::filterInput($_GET['fileName'], 't', 1);
//上传后保存名字
$keyid = zmf::filterInput($_GET['keyid']);
//所属对象ID
if (!isset($uptype) or !in_array($uptype, array('avatar'))) {
$this->jsonOutPut(0, '请设置上传所属类型' . $uptype);
}
if (Yii::app()->request->getParam('PHPSESSID')) {
Yii::app()->session->close();
Yii::app()->session->setSessionID(Yii::app()->request->getParam('PHPSESSID'));
Yii::app()->session->open();
}
if (Yii::app()->user->isGuest) {
$this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
}
// $checkInfo = UserPower::check('addImage', true);
// if (!$checkInfo['status']) {
// $this->jsonOutPut(0, $checkInfo['msg']);
// }
if (!$fileholder) {
$fileholder = 'filedata';
}
if (!isset($_FILES[$fileholder]) || !is_uploaded_file($_FILES[$fileholder]["tmp_name"]) || $_FILES[$fileholder]["error"] != 0) {
$this->jsonOutPut(0, '无效上传,请重试');
}
$img = CUploadedFile::getInstanceByName($fileholder);
$ext = $img->getExtensionName();
$size = $img->getSize();
if ($size > zmf::config('imgMaxSize')) {
$this->jsonOutPut(0, '上传文件最大尺寸为:' . tools::formatBytes(zmf::config('imgMaxSize')));
}
$upExt = zmf::config("imgAllowTypes");
if (!preg_match('/^(' . str_replace('*.', '|', str_replace(';', '', $upExt)) . ')$/i', $ext)) {
$this->jsonOutPut(0, '上传文件扩展名必需为:' . $upExt);
}
if (!$fileName) {
$fileName = uniqid() . '.' . $ext;
}
if ($uptype == 'avatar') {
$fileName = $keyid . '.jpg';
}
$ctime = zmf::now();
$dirs = zmf::uploadDirs($ctime, 'app', $uptype, null, true);
$fileName = uniqid() . '.' . $ext;
$origin = $dirs['origin'];
unset($dirs['origin']);
$fileNameWithoutDomain = zmf::getUpExtraUrl($ctime) . '/600_' . $fileName;
//相对于网站的存放路径
if (move_uploaded_file($_FILES[$fileholder]["tmp_name"], $origin . $fileName)) {
Yii::import('application.vendors.thinkphp.*');
require_once 'ImageGd.php';
foreach ($dirs as $dk => $_dir) {
$image = new ImageGd($origin . $fileName);
$image->thumb($dk, $dk, 'center');
$image->save($_dir . $fileName);
}
Users::model()->updateByPk($this->uid, array('avatar' => $fileNameWithoutDomain));
$imgsize = $reImgsize > 0 ? $reImgsize : 170;
$returnimg = zmf::uploadDirs($ctime, 'site', $uptype, $imgsize) . $fileName;
$outPutData = array('status' => 1, 'imgsrc' => $returnimg, 'attachid' => '');
$json = CJSON::encode($outPutData);
echo $json;
} else {
$this->jsonOutPut(0, '上传失败');
}
}