本文整理汇总了PHP中upload_one函数的典型用法代码示例。如果您正苦于以下问题:PHP upload_one函数的具体用法?PHP upload_one怎么用?PHP upload_one使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upload_one函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create
/**
* 发起反馈
*/
public function create()
{
if (IS_POST) {
$data['seller_id'] = $this->mid;
$data['module'] = MODULE_NAME;
$data['content'] = str_rp(trim($_POST['content']));
$data['contact'] = str_rp(trim($_POST['contact']));
$data['addtime'] = NOW_TIME;
$data['has_reply'] = 0;
//图片上传
if (!empty($_FILES['pic']['size'])) {
$img = 'feedback_' . re_md5(NOW_TIME . nonce_str());
$param = array('savePath' => MODULE_NAME . '/feedback/', 'subName' => '', 'files' => $_FILES['pic'], 'saveName' => $img, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['pic'] = $up_return;
}
}
$res = $this->model->add($data);
if ($res) {
$this->success('谢谢您的意见及建议.', U('detail', array('id' => $res)));
} else {
$this->error('非常抱歉,您的意见及建议没有提交成功.');
}
} elseif (IS_GET) {
$this->h3_title = '发起反馈';
$this->display();
}
}
开发者ID:noikiy,项目名称:baomihua,代码行数:35,代码来源:FeedbackController.class.php
示例2: adv_edit
public function adv_edit()
{
if (IS_POST) {
$ap_id = intval($_POST['ap_id']);
if ($ap_id) {
$data = array('title' => str_rp(trim($_POST['ap_name'])), 'url' => str_rp(trim($_POST['ap_link'])), 'intro' => str_rp(trim($_POST['default_content'])), 'type' => intval($_POST['type']), 'addtime' => NOW_TIME, 'ap_width' => intval($_POST['ap_width']), 'ap_height' => intval($_POST['ap_height']), 'sort' => intval($_POST['sort']));
if (!empty($_FILES['default_pic']['name'])) {
$param = array('savePath' => 'member/' . isLogin() . '/', 'subName' => 'Banner', 'files' => $_FILES['default_pic'], 'saveName' => 'gg_' . $ap_id, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['img'] = $up_return;
}
}
$this->model->where(array('id' => $ap_id, 'uid' => isLogin()))->save($data);
$this->success("操作成功", U('advposition'));
exit;
}
} else {
$id = intval($_GET['ap_id']);
$vo = $this->model->where(array('id' => $id, 'uid' => isLogin()))->find();
$this->assign('vo', $vo);
$this->display('adv_position_edit');
}
}
开发者ID:noikiy,项目名称:ypx,代码行数:27,代码来源:AdvController.class.php
示例3: index
/**
* 基本资料
*/
public function index()
{
$where['member_id'] = $this->mid;
if (IS_POST) {
//图片上传
if (!empty($_FILES['avatar']['size'])) {
$arc_img = 'mid_avatar_' . $this->mid;
$param = array('savePath' => 'member/', 'subName' => '', 'files' => $_FILES['avatar'], 'saveName' => $arc_img, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['avatar'] = $up_return;
}
}
//TODO:验证码
$data['nickname'] = str_rp(trim($_POST['nickname']));
$data['gender'] = intval($_POST['gender']);
$data['age'] = intval($_POST['age']);
$data['mobile'] = str_rp(trimall($_POST['mobile']));
$data['email'] = I('post.email', '', 'email');
$res = M('Member')->where($where)->save($data);
}
$info = M('Member')->where($where)->find();
$this->info = $info;
$this->display();
}
开发者ID:PrayerEzio,项目名称:zuoxika,代码行数:31,代码来源:MemberController.class.php
示例4: send
public function send()
{
if (IS_POST) {
if (empty($_POST)) {
$this->error('非法操作');
}
$add_time_from = trim($_POST['add_time_from']) ? strtotime(trim($_POST['add_time_from'])) : 0;
$add_time_to = trim($_POST['add_time_to']) ? strtotime(trim($_POST['add_time_to'])) : 0;
$email = array('email_title' => trim($_POST['article_title']), 'email_user_id' => isLogin(), 'email_from_time' => $add_time_from, 'email_to_time' => $add_time_to, 'email_time' => NOW_TIME, 'email_status' => intval($_POST['article_show']), 'email_content' => trim($_POST['article_content']));
if (!empty(intval($_POST['email_id']))) {
$id = intval($_POST['email_id']);
$this->modE->where(array('email_id' => $id))->save($email);
} else {
$id = $this->modE->add($email);
}
if ($id) {
if (!empty($_FILES)) {
$filename = 'epic_' . $id;
$param = array('savePath' => 'email/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $filename, 'saveExt' => '');
$path = upload_one($param);
if ($path != 'error') {
$res = $this->modE->where(array('email_id' => $id))->setField('email_file', $path);
} else {
$this->modE->where(array('email_id' => $id))->delete();
$this->error('附件上传失败');
die;
}
}
$user = $_POST['user'];
foreach ($user as $key => $val) {
$dataList[$key] = array('email_id' => $id, 'user_id' => $val, 'user_status' => 0);
}
M('EmailStatus')->addAll($dataList);
$this->success('邮件发送成功', U('delivery'));
}
} else {
$id = intval($_GET['id']);
if (!empty($id)) {
$info = $this->modE->where(array('email_id' => $id))->find();
$this->info = $info;
$this->title = '编辑任务';
} else {
$this->title = '添加任务';
}
$this->depart = M('AuthGroup')->where(array('status' => 1))->field(array('id', 'title'))->select();
$user = D('AdminView')->where(array('admin_id' => array('neq', isLogin())))->field(array('admin_id', 'admin_name', 'title'))->group('uid')->select();
$this->user = $user;
$this->display();
}
}
开发者ID:noikiy,项目名称:oa,代码行数:50,代码来源:EmailController.class.php
示例5: curd
public function curd()
{
if (IS_POST) {
$data['member_name'] = str_rp(trim($_POST['member_name']));
$data['nickname'] = str_rp(trim($_POST['nickname']));
$data['email'] = str_rp(trim($_POST['email']));
$data['mobile'] = str_rp(trim($_POST['mobile']));
$data['qq'] = str_rp(trim($_POST['qq']));
$data['predeposit'] = floatval($_POST['predeposit']);
$data['frozen'] = floatval($_POST['frozen']);
$data['score'] = intval($_POST['score']);
$data['point'] = intval($_POST['point']);
$data['member_status'] = intval($_POST['member_status']);
$member_id = intval($_POST['member_id']);
//图片上传
if ($_FILES['id_card']['size']) {
$arc_img = 'idcard_' . $member_id;
$param = array('savePath' => 'id_card/', 'subName' => '', 'files' => $_FILES['id_card'], 'saveName' => $arc_img, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['id_card'] = $up_return;
}
}
if ($member_id) {
$res = $this->model->where(array('member_id' => $member_id))->save($data);
if ($res) {
$this->success('修改会员资料成功');
} else {
$this->error('修改会员资料失败');
}
} else {
$this->error('非法操作');
}
} elseif (IS_GET) {
$where['member_id'] = intval($_GET['id']);
$info = $this->model->relation(true)->where($where)->find();
$this->title = '会员信息-' . get_member_nickname($info['member_id']);
$this->assign('info', $info);
$this->display();
}
}
开发者ID:noikiy,项目名称:baomihua,代码行数:44,代码来源:MemberController.class.php
示例6: member_edit
public function member_edit()
{
if (IS_POST) {
$more_address = serialize($_POST['more_address']);
$old_pwd = M('Member')->where(array('uid' => isLogin(), 'status' => 1))->getField('password');
if (empty($_POST['password'])) {
$this->error('密码不能为空');
}
if ($old_pwd == $_POST['password']) {
$password = $_POST['password'];
} else {
$password = re_md5($_POST['password']);
}
$data = array('password' => $password, 'long_name' => str_rp(trim($_POST['long_name'])), 'nickname' => str_rp(trim($_POST['nickname'])), 'contact_phone' => str_rp(trim($_POST['contact_phone'])), 'contact_name' => str_rp(trim($_POST['contact_name'])), 'school_phone' => str_rp(trim($_POST['school_phone'])), 'school_address' => str_rp(trim($_POST['school_address'])), 'more_address' => serialize($_POST['more_address']), 'qq' => str_rp(trim($_POST['qq'])), 'email' => str_rp(trim($_POST['email'])), 'fax' => str_rp(trim($_POST['fax'])), 'school_desc' => str_replace('\'', ''', $_POST['school_desc']));
unset($lastpath);
unset($up_return);
unset($filename);
if (!empty($_FILES['avatar']['size'])) {
$lastpath = M('Member')->where(array('uid' => isLogin()))->getField('avatar');
$filename = 'avatar_' . nonce_str(8, 1, 1, 1);
$param = array('savePath' => 'member/', 'subName' => isLogin(), 'exts' => '', 'files' => $_FILES['avatar'], 'saveName' => $filename, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return) {
@unlink(BasePath . '/Uploads/' . $lastpath);
$data['avatar'] = $up_return;
} else {
$this->error('上传头像失败');
}
}
$res = M('Member')->where(array('uid' => isLogin()))->save($data);
if ($res) {
$this->success('操作成功', U('member'));
} else {
$this->error('操作失败');
}
} else {
$info = M('Member')->where(array('uid' => isLogin()))->find();
$info['more_address'] = unserialize($info['more_address']);
$info['numAdd'] = count($info['more_address']);
$this->vo = $info;
$this->display();
}
}
开发者ID:noikiy,项目名称:ypx,代码行数:43,代码来源:MemberController.class.php
示例7: curdShop
public function curdShop()
{
if (IS_POST) {
$id = intval($_POST['id']);
$latlng = explode(',', $_POST['latLng']);
$data = array('store_name' => str_rp($_POST['store_name']), 'store_tel' => str_rp($_POST['store_tel']), 'store_address' => str_rp($_POST['address']), 'store_lat' => str_rp(trim($latlng[0])), 'store_lng' => str_rp(trim($latlng[1])), 'store_num' => str_rp(trim($_POST['store_num'])), 'store_status' => intval($_POST['store_status']), 'store_intro' => str_rp(trim($_POST['store_intro'])));
if ($id) {
$res = $this->ba_mod->where(array('store_id' => $id))->save($data);
} else {
$id = $this->ba_mod->add($data);
}
if ($_FILES['article_pic']['size'] > 0) {
$filename = 'store_' . $id;
$param = array('savePath' => 'store/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $filename);
$path = upload_one($param);
if ($path != 'error') {
$id = $this->ba_mod->where(array('store_id' => $id))->setField('store_pic', $path);
} else {
$this->ba_mod->where(array('store_id' => $res))->delete();
$this->error('文件上传失败');
die;
}
}
if ($id) {
$this->success('操作成功', U('shoplist'));
} else {
$this->error('操作失败');
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
if ($id) {
$this->info = $this->ba_mod->where(array('store_id' => $id))->find();
}
$this->title = '添加店铺';
$this->display();
} elseif (IS_AJAX) {
$id = intval($_POST['id']);
if ($id) {
$res = $this->ba_mod->where(array('store_id' => $id))->delete();
echo $res;
}
}
}
开发者ID:noikiy,项目名称:sryy,代码行数:43,代码来源:ShopController.class.php
示例8: curdhonor
public function curdhonor()
{
if (IS_AJAX) {
$id = intval($_POST['id']);
if ($id) {
$res = $this->ba_mod->where(array('id' => $id))->delete();
echo $res;
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
if ($id) {
$this->info = $this->ba_mod->where(array('id' => $id))->find();
}
$this->title = 'honor管理';
$this->display();
} elseif (IS_POST) {
$id = intval($_POST['id']);
$data = array('title' => str_rp($_POST['title']), 'viewcount' => intval($_POST['viewcount']), 'sort' => intval($_POST['sort']), 'status' => intval($_POST['status']), 'addtime' => NOW_TIME, 'content' => str_replace('\'', ''', $_POST['content']));
if ($id) {
$res = $this->ba_mod->where(array('id' => $id))->save($data);
} else {
$id = $this->ba_mod->add($data);
}
if ($_FILES['article_pic']['size'] > 0) {
$param = array('savePath' => 'honor/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => 'honor_' . $id, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->ba_mod->where(array('id' => $id))->delete();
$this->error('图片上传失败');
exit;
} else {
$res = $this->ba_mod->where(array('id' => $id))->setField('pic', $up_return);
}
}
if ($res) {
$this->success('操作成功', U('honorlist'));
} else {
$this->error('操作失败');
}
}
}
开发者ID:noikiy,项目名称:sryy,代码行数:41,代码来源:HonorController.class.php
示例9: curdBanner
public function curdBanner()
{
if (IS_AJAX) {
$id = intval($_POST['id']);
if ($id) {
$res = $this->ba_mod->where(array('id' => $id))->delete();
echo $res;
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
if ($id) {
$this->info = $this->ba_mod->where(array('id' => $id))->find();
}
$this->title = 'Banner管理';
$this->display();
} elseif (IS_POST) {
$id = intval($_POST['id']);
$data = array('title' => str_rp($_POST['title']), 'url' => str_rp($_POST['url']), 'intro' => str_rp($_POST['intro']), 'type' => intval($_POST['type']), 'sort' => intval($_POST['sort']), 'status' => intval($_POST['status']));
if ($id) {
$res = $this->ba_mod->where(array('id' => $id))->save($data);
} else {
$id = $this->ba_mod->add($data);
}
if ($_FILES['article_pic']['size'] > 0) {
$param = array('savePath' => 'banner/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => 'banner_' . $id, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->ba_mod->where(array('id' => $id))->delete();
$this->error('图片上传失败');
exit;
} else {
$res = $this->ba_mod->where(array('id' => $id))->setField('img', $up_return);
}
}
if ($res) {
$this->success('操作成功', U('bannerlist'));
} else {
$this->error('操作失败');
}
}
}
开发者ID:noikiy,项目名称:sryy,代码行数:41,代码来源:BannerController.class.php
示例10: goods_edit
public function goods_edit()
{
$goods_id = intval($_REQUEST['goods_id']);
if (IS_POST) {
$data = array();
$data['gc_id'] = intval($_POST['gc_id']);
$data['brand_id'] = intval($_POST['brand_id']);
$data['goods_name'] = str_rp(trim($_POST['goods_name']));
$data['goods_code'] = str_rp(trim($_POST['goods_code']));
$data['goods_type'] = str_rp(trim($_POST['goods_type']));
$data['goods_type_id'] = get_goods_type_id($data['gc_id']);
$data['goods_city_id'] = intval(trim($_POST['goods_city_id']));
$data['goods_key'] = str_rp(trim($_POST['goods_key']));
$data['goods_desc'] = str_rp(trim($_POST['goods_desc']));
$data['goods_url'] = str_rp(trim($_POST['goods_url']));
$data['goods_storage'] = intval($_POST['goods_storage']);
$data['goods_serial'] = str_rp(trim($_POST['goods_serial']));
$data['store_name'] = str_rp(trim($_POST['store_name']));
$data['goods_price'] = price_format($_POST['goods_price']);
$data['goods_mktprice'] = price_format($_POST['goods_mktprice']);
$data['member_price'] = price_format($_POST['member_price']);
$data['goods_point'] = intval($_POST['goods_point']);
$data['goods_sort'] = intval($_POST['goods_sort']);
$data['goods_body'] = str_replace('\'', ''', $_POST['goods_body']);
$data['goods_status'] = intval($_POST['goods_status']);
$data['add_time'] = NOW_TIME;
$data['display_technique'] = str_rp($_POST['display_technique'], 1);
$data['bulb_brand'] = str_rp($_POST['bulb_brand'], 1);
$data['bulb_wattage'] = str_rp($_POST['bulb_wattage'], 1);
$data['bulb_code'] = str_rp($_POST['bulb_code'], 1);
$data['factory_code'] = str_rp($_POST['factory_code'], 1);
$data['factory_brand'] = str_rp($_POST['factory_brand'], 1);
//图片上传
if (!empty($_FILES['goods_pic']['name'])) {
$goods_img = 'g_' . $data['add_time'];
$gd = $this->model->where('goods_id=' . $goods_id)->find();
if ($gd['goods_pic']) {
$old_pic = BasePath . '/Uploads/' . $gd['goods_pic'];
unlink($old_pic);
}
$param = array('savePath' => 'goods/', 'subName' => '', 'files' => $_FILES['goods_pic'], 'saveName' => $goods_img, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['goods_pic'] = $up_return;
}
}
$return = $this->model->where('goods_id=' . $goods_id)->save($data);
if ($return) {
//search处理
$search['url'] = U('Goods/detail', array('goods_id' => $goods_id));
$search['title'] = $data['goods_name'];
$search['keywords'] = $data['goods_key'];
$search['description'] = $data['goods_desc'];
$search['img'] = $up_return;
//规格处理
$GoodsSpec = M('GoodsSpec');
$spec_val = $_POST['s_value'];
if (is_array($spec_val) && !empty($spec_val)) {
$GoodsSpec->where('goods_id=' . $goods_id)->delete($data);
// 删除原来的规格
foreach ($spec_val as $k => $val) {
$val['sort'] = intval($val['sort']);
$val['name'] = trim($val['name']);
if ($val['name']) {
/**
* 新增规格值
*/
$val_add = array();
$val_add['goods_id'] = $goods_id;
$val_add['spec_name'] = trim($val['name']);
$val_add['spec_goods_price'] = price_format(trim($val['price']));
$val_add['spec_goods_sort'] = intval($val['sort']);
$return = $GoodsSpec->add($val_add);
$search['keywords'] .= ',' . $val_add['spec_name'];
unset($val_add);
}
}
$search_id = $this->model->where(array('goods_id' => $goods_id))->getField('search_id');
if (empty($search_id)) {
$search_id = '';
}
$search_id = addSearch($search['url'], $search['title'], $search['keywords'], $search['description'], $search_id, $search['img']);
$this->model->where(array('goods_id' => $goods_id))->setField('search_id', $search_id);
//更新商品列表默认规格信息
$df_spec = M('GoodsSpec')->where('goods_id=' . $goods_id)->order('spec_goods_price asc')->find();
if (is_array($df_spec) && !empty($df_spec)) {
$spec_data = array();
$spec_data['spec_id'] = $df_spec['spec_id'];
$spec_data['spec_name'] = $df_spec['spec_name'];
}
} else {
$spec_data = array();
$spec_data['spec_id'] = 0;
$spec_data['spec_name'] = '';
$this->model->where('goods_id=' . $goods_id)->save($spec_data);
$GoodsSpec->where('goods_id=' . $goods_id)->delete($data);
// 删除原来的规格
//.........这里部分代码省略.........
开发者ID:PrayerEzio,项目名称:zuoxika,代码行数:101,代码来源:GoodsController.class.php
示例11: gift_edit
public function gift_edit()
{
if (IS_POST) {
$sg_id = intval($_POST['sg_id']);
$data = array();
$data['sg_name'] = trim($_POST['sg_name']);
$data['sg_code'] = trim($_POST['sg_code']);
$data['sg_intro'] = str_replace('\'', ''', $_POST['sg_intro']);
$data['sg_point'] = intval($_POST['sg_point']);
$data['sg_price'] = price_format(trim($_POST['sg_price']));
$data['sg_num'] = intval($_POST['sg_num']);
$data['sg_limit_num'] = intval($_POST['sg_limit_num']);
$data['sg_member_degree'] = intval($_POST['sg_member_degree']);
$data['sg_recommend'] = intval($_POST['sg_recommend']);
$data['sg_sale'] = intval($_POST['sg_sale']);
//$data['sg_add_time'] = NOW_TIME;
$data['sg_last_change_time'] = NOW_TIME;
if (!empty($_FILES['sg_pic']['name'])) {
$param = array('savePath' => 'gift/', 'subName' => '', 'files' => $_FILES['sg_pic'], 'saveName' => 'gf_' . $sg_id, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['sg_pic'] = $up_return;
}
}
$this->model->where('sg_id=' . $sg_id)->save($data);
$this->success("操作成功", U('gift_manage'));
exit;
} else {
$sg_id = intval($_GET['sg_id']);
$vo = $this->model->where('sg_id=' . $sg_id)->find();
//会员等级
$member_degree = M('MemberDegree')->select();
$this->assign('member_degree', $member_degree);
$this->assign('vo', $vo);
$this->display();
}
}
开发者ID:noikiy,项目名称:oa,代码行数:40,代码来源:GiftController.class.php
示例12: spec_edit
public function spec_edit()
{
$SpecValue = M('SpecValue');
if (IS_POST) {
/**
* 更新规格值表
*/
$string_value = '';
$spec_val = $_POST['s_value'];
if (is_array($spec_val) && !empty($spec_val)) {
// 要删除的规格值id
$del_array = array();
if (!empty($_POST['s_del'])) {
$del_array = $_POST['s_del'];
}
foreach ($spec_val as $k => $val) {
$val['name'] = trim($val['name']);
$val['sort'] = intval($val['sort']);
if (isset($val['form_submit']) && $val['form_submit'] == 'ok' && !in_array($k, $del_array)) {
if ($_POST['s_dtype'] == 'text') {
/**
* 判断原有图片是否存在,如存在删除
*/
if (isset($val['image']) && $val['image'] != '') {
/**
* 删除图片
*/
@unlink(C('SiteUrl') . '/Uploads/' . $val['image']);
}
$val['image'] = '';
} else {
if ($_POST['s_dtype'] == 'image') {
//图片模式
/**
* 图片上传
*/
if (!empty($_FILES['s_value_' . $k]['name'])) {
if (isset($val['image']) && $val['image'] != '') {
/**
* 删除图片
*/
@unlink(C('SiteUrl') . '/Uploads/' . $val['image']);
}
$spc_img_name = 'spc_' . NOW_TIME . $k;
$param = array('savePath' => 'spec/', 'subName' => '', 'files' => $_FILES['s_value_' . $k], 'saveName' => $spc_img_name, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
} else {
$val['image'] = $up_return;
}
}
}
}
/**
* 更新规格值
*/
$spc_data = array();
$spc_data['sp_value_name'] = $val['name'];
$spc_data['sp_value_image'] = $val['image'];
$spc_data['sp_value_sort'] = $val['sort'];
$spc_map = array();
$spc_map['sp_value_id'] = array('eq', $k);
$spc_map['sp_id'] = array('eq', intval($_POST['s_id']));
$return = $SpecValue->where($spc_map)->save($spc_data);
if (!$return) {
$this->error('规格信息更新失败');
}
$string_value .= $val['name'] . ',';
unset($spc_data);
unset($spc_map);
} else {
if (isset($val['form_submit']) && $val['form_submit'] == '' && !in_array($k, $del_array)) {
//原有规格未修改
if ($_POST['s_dtype'] == 'text') {
/**
* 判断原有图片是否存在,如存在删除
*/
if (isset($val['image']) && $val['image'] != '') {
/**
* 删除图片
*/
@unlink(C('SiteUrl') . '/Uploads/' . $val['image']);
/**
* 更新规格值
*/
$spc_map = array();
$spc_map['sp_value_id'] = array('eq', $k);
$spc_map['sp_id'] = array('eq', intval($_POST['s_id']));
$return = $SpecValue->where($spc_map)->setField('sp_value_image', '');
if (!$return) {
$this->error('规格信息更新失败');
}
unset($spc_map);
}
$val['image'] = '';
}
$string_value .= $val['name'] . ',';
} else {
if (!in_array($k, $del_array)) {
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:oa,代码行数:101,代码来源:SpecController.class.php
示例13: curdAdmin
public function curdAdmin()
{
if (IS_POST) {
$admin_id = intval($_POST['admin_id']);
if (empty($admin_id)) {
$data = array('admin_name' => trim($_POST['name']), 'admin_pwd' => re_md5(trim($_POST['password'])));
$admin_id = M('admin')->add($data);
if (!empty($_FILES)) {
$filename = 'sign_' . $admin_id;
$param = array('savePath' => 'signature/', 'subName' => '', 'files' => $_FILES['sign_pic'], 'saveName' => $filename, 'saveExt' => '', 'replace' => true);
$path = upload_one($param);
M('admin')->where(array('admin_id' => $admin_id))->setField('admin_signature', $path);
}
$group = $_POST['group'];
if (is_array($group) && !empty($group)) {
foreach ($group as $key => $val) {
$access = array('uid' => $admin_id, 'group_id' => $val);
M('AuthGroupAccess')->add($access);
}
}
addLog('新增管理员ID-[' . $admin_id . ']');
$this->success('添加管理员成功', U('Auth/adminList'));
} else {
$data = array('admin_name' => trim($_POST['name']), 'admin_pwd' => re_md5(trim($_POST['password'])));
M('admin')->where(array('admin_id' => $admin_id))->save($data);
M('AuthGroupAccess')->where(array('uid' => $admin_id))->delete();
if (!empty($_FILES)) {
$filename = 'sign_' . $admin_id;
$param = array('savePath' => 'signature/', 'subName' => '', 'files' => $_FILES['sign_pic'], 'saveName' => $filename, 'saveExt' => '', 'replace' => true);
$path = upload_one($param);
$image = new \Think\Image();
$image->open('./Uploads/' . $path);
$image->thumb(150, 150)->save('./Uploads/' . $path);
M('admin')->where(array('admin_id' => $admin_id))->setField('admin_signature', $path);
}
$group = $_POST['group'];
if (is_array($group) && !empty($group)) {
foreach ($group as $key => $val) {
$access = array('uid' => $admin_id, 'group_id' => $val);
M('AuthGroupAccess')->add($access);
}
}
addLog('编辑管理员ID-[' . $admin_id . ']');
$this->success('编辑管理员成功', U('Auth/adminList'));
}
} else {
if ($_GET['admin_id']) {
$type = trim($_GET['type']);
$admin_id = intval($_GET['admin_id']);
if ($type == 'edit') {
$this->title = "编辑管理员";
$mod = D('admin');
$this->info = $mod->where(array('admin_id' => $admin_id))->field(array('admin_id', 'admin_name'))->find();
$group = M('AuthGroup')->select();
$acc = M('AuthGroupAccess')->where(array('uid' => $admin_id))->field(array('group_id'))->select();
if (is_array($acc) && !empty($acc)) {
foreach ($acc as $key => $val) {
$access[] = $val['group_id'];
}
foreach ($group as $key => $val) {
if (in_array($val['id'], $access)) {
$group[$key]['checked'] = 1;
}
}
}
$this->group = $group;
$this->display();
} elseif ($type == 'del') {
if ($admin_id == isLogin()) {
$this->error('您不能删除自己的账号');
} else {
$result = $this->model->where(array('admin_id' => $admin_id))->delete();
if ($result) {
M('AuthGroupAccess')->where(array('uid' => $admin_id))->delete();
addLog('删除管理员ID-[' . $admin_id . ']');
$this->success('删除账号成功');
} else {
$this->error('删除账号失败');
}
}
} else {
$this->error('非法操作');
}
} else {
$this->title = "添加管理员";
$this->group = M('AuthGroup')->select();
$this->display();
}
}
}
开发者ID:noikiy,项目名称:oa,代码行数:90,代码来源:AuthController.class.php
示例14: adv_edit
public function adv_edit()
{
if (IS_POST) {
$ap_id = intval($_POST['ap_id']);
if ($ap_id) {
$data = array();
$data['ap_name'] = trim($_POST['ap_name']);
$data['ap_code'] = trim($_POST['ap_code']);
$data['ap_intro'] = trim($_POST['ap_intro']);
$data['ap_link'] = trim($_POST['ap_link']);
$data['ap_price'] = price_format($_POST['ap_price']);
$data['ap_class'] = intval($_POST['ap_class']);
$data['is_use'] = intval($_POST['is_use']);
$data['ap_width'] = intval($_POST['ap_width']);
$data['ap_height'] = intval($_POST['ap_height']);
$data['default_content'] = trim($_POST['default_content']);
if (!empty($_FILES['default_pic']['name'])) {
$param = array('savePath' => 'adv/', 'subName' => '', 'files' => $_FILES['default_pic'], 'saveName' => 'gg_' . $ap_id, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['ap_pic'] = $up_return;
}
}
$this->model->where('ap_id=' . $ap_id)->save($data);
$this->success("操作成功", U('adv_position'));
exit;
}
} else {
$ap_id = intval($_GET['ap_id']);
$vo = $this->model->where('ap_id=' . $ap_id)->find();
$this->assign('vo', $vo);
$this->display('adv_position_edit');
}
}
开发者ID:noikiy,项目名称:sryy,代码行数:37,代码来源:AdvController.class.php
示例15: photo_edit
public function photo_edit()
{
if (IS_POST) {
$id = intval($_POST['id']);
$data = array('title' => str_rp(trim($_POST['title'])), 'cate_id' => intval($_POST['ac_id']), 'status' => intval($_POST['status']), 'asort' => intval($_POST['article_sort']), 'read_count' => intval($_POST['read_count']), 'des' => str_rp(trim($_POST['des'])), 'content' => str_rp(trim($_POST['content'])));
//图片上传
if (!empty($_FILES['article_pic']['name'])) {
$filename = 'photoImg_' . $id;
$param = array('savePath' => 'artic/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $filename, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['img'] = $up_return;
}
}
D('Photo')->where('id=' . $id)->save($data);
$this->success('操作成功', U('photo'));
exit;
} else {
$id = intval($_GET['id']);
if ($id) {
$vo = D('Photo')->relation(true)->where('id=' . $id)->find();
$this->assign('vo', $vo);
$this->display('photo_edit');
}
}
}
开发者ID:noikiy,项目名称:ypx,代码行数:29,代码来源:ArticleController.class.php
示例16: agent_edit
public function agent_edit()
{
$id = intval($_REQUEST['id']);
if (IS_POST) {
$data = array();
$data['nick_name'] = trim($_POST['nick_name']);
$data['true_name'] = trim($_POST['true_name']);
$data['level_name'] = trim($_POST['level_name']);
$data['address'] = trim($_POST['address']);
$data['wexin_id'] = trim($_POST['wexin_id']);
$data['agent_sort'] = intval($_POST['agent_sort']);
$data['agent_time'] = NOW_TIME;
$agent_pic = 'ap_' . $data['agent_time'];
$agent_ewm = 'ewm_' . $data['agent_time'];
//图片上传
if (!empty($_FILES['agent_pic']['name'])) {
$param = array('savePath' => 'agent/', 'subName' => '', 'files' => $_FILES['agent_pic'], 'saveName' => $agent_pic, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['agent_pic'] = $up_return;
}
}
if (!empty($_FILES['agent_ewm']['name'])) {
$param = array('savePath' => 'agent/', 'subName' => '', 'files' => $_FILES['agent_ewm'], 'saveName' => $agent_ewm, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['agent_ewm'] = $up_return;
}
}
$return = $this->model->where('id=' . $id)->save($data);
if ($return) {
$this->success('操作成功', U('agent'));
exit;
} else {
$this->error('操作失败');
}
} else {
$rs = $this->model->where('id=' . $id)->find();
$this->assign('rs', $rs);
$this->display();
}
}
开发者ID:PrayerEzio,项目名称:zuoxika,代码行数:48,代码来源:AgentController.class.php
示例17: base_information
public function base_information()
{
$Setting = M('Setting');
if (IS_POST) {
$data = array();
if (!empty($_FILES['site_logo']['name'])) {
$param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['site_logo'], 'saveName' => 'site_logo', 'saveExt' => '');
//$up_return = upload_one($param);
$up_return = upload_one_thumb($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['site_logo'] = $up_return;
}
}
if (!empty($_FILES['member_logo']['name'])) {
$param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['member_logo'], 'saveName' => 'member_logo', 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['member_logo'] = $up_return;
}
}
if (!empty($_FILES['seller_logo']['name'])) {
$param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['seller_logo'], 'saveName' => 'seller_logo', 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['seller_logo'] = $up_return;
}
}
if (!empty($_FILES['weixin_qrcode']['name'])) {
$param = array('savePath' => 'commo
|
请发表评论