public function update() { if (!$this->input['id']) { $this->errorOutput(NOID); } $update_data = array('name' => trim($this->input['name']), 'points_system' => $this->input['points_system'], 'is_login' => intval($this->input['is_login'])); //数据验证 $this->data_check($data, $this->input['old_name']); //上传索引图 $cover['Filedata'] = $_FILES['Filedata']; $cover2['Filedata'] = $_FILES['Filedata2']; include_once ROOT_PATH . 'lib/class/material.class.php'; $material = new material(); if ($cover['Filedata']) { $re = $material->addMaterial($cover); $cover = array(); $cover = array('host' => $re['host'], 'dir' => $re['dir'], 'filepath' => $re['filepath'], 'filename' => $re['filename']); $update_data['index_pic'] = addslashes(serialize($cover)); } //上传默认图 if ($cover2['Filedata']) { $re2 = $material->addMaterial($cover2); $cover2 = array(); $cover2 = array('host' => $re2['host'], 'dir' => $re2['dir'], 'filepath' => $re2['filepath'], 'filename' => $re2['filename']); $update_data['default_pic'] = addslashes(serialize($cover2)); } $ret = $this->mode->update($this->input['id'], $update_data); if ($ret) { //如果内容有更新才更新以下内容 $update_data['update_user_name'] = $this->user['user_name']; $update_data['update_user_id'] = $this->user['user_id']; $update_data['update_org_id'] = $this->user['org_id']; $update_data['update_time'] = TIMENOW; $update_data['update_ip'] = $this->user['ip']; $sql = "UPDATE " . DB_PREFIX . "grade_style SET \n\t\t\t\t\tupdate_user_name ='" . $update_data['update_user_name'] . "',\n\t\t\t\t\tupdate_user_id = '" . $update_data['update_user_id'] . "',\n\t\t\t\t\tupdate_org_id = '" . $update_data['update_org_id'] . "',\n\t\t\t\t\tupdate_ip = '" . $update_data['update_ip'] . "', \n\t\t\t\t\tupdate_time = '" . TIMENOW . "' WHERE id=" . $this->input['id']; $this->db->query($sql); //更新描述 if ($this->input['is_describe']) { $names = $this->input['name']; //简述词 $describes = $this->input['describe']; //描述 if ($names || $describes) { foreach ($names as $k => $v) { $describe_data = array('style_id' => $vid, 'star' => $k, 'name' => trim($v), 'describes' => trim($describes[$k])); $this->mode->update_describe($this->input['id'], $describe_data); } } } } //$this->addLogs('更新',$ret,'','更新' . $this->input['id']);此处是日志,自己根据情况加一下 $this->addItem('success'); $this->output(); }
/** * 上传图片 * */ public function upload_img() { $logo['Filedata'] = $_FILES['pic']; if ($logo['Filedata']) { $material_pic = new material(); $logo_info = $material_pic->addMaterial($logo); $logo = array(); $logo_pic = array('host' => $logo_info['host'], 'dir' => $logo_info['dir'], 'filepath' => $logo_info['filepath'], 'filename' => $logo_info['filename']); $img_info = addslashes(serialize($logo_pic)); } if (!$logo_pic) { $this->errorOutput('没有上传的图片信息'); } $logoid = intval($this->input['logoid']); if ($logoid) { $sql = 'SELECT id FROM ' . DB_PREFIX . "material WHERE id = " . $logoid; $ret = $this->db->query_first($sql); } if ($logoid && $ret['id']) { $sql = " UPDATE " . DB_PREFIX . "material SET img_info = '" . $img_info . "' WHERE id = " . $logoid; $query = $this->db->query($sql); $data['id'] = $logoid; } else { $sql = " INSERT INTO " . DB_PREFIX . "material SET img_info = '" . $img_info . "'"; $query = $this->db->query($sql); $vid = $this->db->insert_id(); $data['id'] = $vid; } $data['img_info'] = hg_fetchimgurl($logo_pic, 200, 160); $this->addItem($data); $this->output(); }
public function update() { $data = array('id' => intval($this->input['id']), 'name' => trim($this->input['name'])); if (!$data['id']) { $this->errorOutput("ID不能为空"); } if (!$data['name']) { $this->errorOutput("运势名不能为空"); } $sql = 'SELECT * FROM ' . DB_PREFIX . 'astro_app_fortuneinfo WHERE id = ' . $data['id']; $res = $this->db->query_first($sql); $astrofunimg = unserialize($res['astrofunimg']) ? unserialize($res['astrofunimg']) : array(); $logo['Filedata'] = $_FILES['logo']; if ($logo['Filedata']) { include_once ROOT_PATH . 'lib/class/material.class.php'; $material = new material(); $re = $material->addMaterial($logo); $logo = array(); $logo = array('host' => $re['host'], 'dir' => $re['dir'], 'filepath' => $re['filepath'], 'filename' => $re['filename']); } else { $logo = $astrofunimg; } $where = ' WHERE 1 '; $where .= ' AND id = ' . $data['id']; $sql = 'UPDATE ' . DB_PREFIX . 'astro_app_fortuneinfo' . ' SET astrofuncn = "' . $data['name'] . '", astrofunimg ="' . addslashes(serialize($logo)) . '"' . $where; //$this->errorOutput($sql); $this->db->query($sql); $this->constellation->updatetime_orerid($data['id'], 'fortuneinfo'); $data['logo'] = $logo; $this->addItem($data); $this->output(); }
public function insert_plataccount($picfiles) { $data = array('type' => urldecode($this->input['plat_type']), 'name' => urldecode($this->input['name']), 'offiaccount' => urldecode($this->input['offiaccount']), 'akey' => urldecode($this->input['apikey']), 'skey' => urldecode($this->input['secretkey']), 'oauthurl' => urldecode($this->input['oauthurl']), 'shareurl' => urldecode($this->input['shareurl']), 'userurl' => urldecode($this->input['userurl']), 'callback' => urldecode($this->input['callback']), 'accessurl' => urldecode($this->input['accessurl']), 'followurl' => urldecode($this->input['followurl']), 'status' => urldecode($this->input['status']), 'addtime' => time()); $sql = "INSERT INTO " . DB_PREFIX . "plat SET"; $sql_extra = $space = ' '; foreach ($data as $k => $v) { $sql_extra .= $space . $k . "='" . $v . "'"; $space = ','; } $sql .= $sql_extra; $this->db->query($sql); $id = $this->db->insert_id(); /*将图片提交到图片服务器*/ $files['Filedata'] = $picfiles; if ($files['Filedata']) { $material_pic = new material(); $img_info = $material_pic->addMaterial($files, $id, $this->input['module_id'], 'img10'); $img_thumb_info = $this->get_thumb_pic($img_info['filepath'], $img_info['filename']); //去请求一张缩略图 $data = array('platId' => $id, 'oldname' => $files['Filedata']['name'], 'newname' => $img_info['filename'], 'addtime' => time(), 'path' => $img_info['filepath']); //判断是否存在封面 如果不存在则以第一幅图片做为封面 $sql = 'UPDATE ' . DB_PREFIX . 'plat SET picurl = "' . $data['path'] . $data['newname'] . '" WHERE id = ' . $data['platId']; $this->db->query($sql); $sql = "INSERT INTO " . DB_PREFIX . "pics SET"; $sql_extra = $space = ' '; foreach ($data as $k => $v) { $sql_extra .= $space . $k . "='" . $v . "'"; $space = ','; } $sql .= $sql_extra; $this->db->query($sql); } return true; }
public function update() { if (!$this->input['id']) { $this->errorOutput(NOID); } $data = array('name' => $this->input['name'], 'description' => $this->input['description'], 'need_update' => intval($this->input['need_update'])); //处理logo图片 if ($_FILES['map_marker']) { $_FILES['Filedata'] = $_FILES['map_marker']; $material_pic = new material(); $img_info = $material_pic->addMaterial($_FILES); if ($img_info) { $map_marker = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename']); $data['map_marker'] = @serialize($map_marker); } } $ret = $this->mode->update($data, $this->input['id']); if ($ret) { $update_data = array('user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'update_time' => TIMENOW, 'ip' => hg_getip()); $pre_data = $this->mode->update($update_data, $this->input['id']); $up_data = $data + $update_data; $this->addLogs('更新停车场类型', $pre_data, $up_data, $up_data['name']); } $this->addItem('success'); $this->output(); }
public function update() { if (!$this->input['id']) { $this->errorOutput(NOID); } $name = $this->input['name']; $body_html = $this->input['body_html']; if (!$name) { $this->errorOutput(NO_TPL_NAME); } if (!$body_html) { $this->errorOutput(NO_TPL_HTML); } $update_data = array('name' => $name, 'body_html' => $body_html, 'type' => intval($this->input['type']), 'update_time' => TIMENOW); //更改图片 if (isset($_FILES['img_info']) && !$_FILES['img_info']['error']) { $_FILES['Filedata'] = $_FILES['img_info']; $material_pic = new material(); $img = $material_pic->addMaterial($_FILES); if ($img) { $img_info = array('host' => $img['host'], 'dir' => $img['dir'], 'filepath' => $img['filepath'], 'filename' => $img['filename'], 'imgwidth' => $img['imgwidth'], 'imgheight' => $img['imgheight']); $update_data['img_info'] = @serialize($img_info); } } $ret = $this->mode->update($this->input['id'], $update_data); if ($ret) { $this->addItem('success'); $this->output(); } }
public function update() { if (!$this->input['id']) { $this->errorOutput(NOID); } $data = array('name' => $this->input['name'], 'enterprise_nature' => $this->input['enterprise_nature'], 'description' => $this->input['description'], 'tel' => $this->input['tel'], 'parking_num' => $this->input['parking_num'], 'address' => $this->input['address']); //处理logo图片 if ($_FILES['logo']) { $_FILES['Filedata'] = $_FILES['logo']; $material_pic = new material(); $img_info = $material_pic->addMaterial($_FILES); if ($img_info) { $logo = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename']); $data['logo'] = @serialize($logo); } } $ret = $this->mode->update($data, $this->input['id']); if ($ret) { $update_data = array('user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'update_time' => TIMENOW, 'ip' => hg_getip()); $pre_data = $this->mode->update($update_data, $this->input['id']); $up_data = $data + $update_data; $this->addLogs('更新物业单位', $pre_data, $up_data, $up_data['name']); } $this->addItem('success'); $this->output(); }
public function upload() { if ($_FILES['Filedata']) { if ($_FILES['Filedata']['error']) { $this->addItem(array('error' => '图片有误')); $this->output(); } else { /* $tmp = getimagesize($_FILES['Filedata']['tmp_name']); if($tmp[0]<2100) { $this->addItem(array('error' => '图片宽度必须大于2100')); $this->output(); } if($tmp[1]<1400) { $this->addItem(array('error' => '图片高度必须大于1400')); $this->output(); } */ include_once ROOT_PATH . '/lib/class/material.class.php'; $obj_material = new material(); $ret = $obj_material->addMaterial($_FILES); if (!empty($ret)) { $this->addItem($ret); $this->output(); } } } }
public function img_upload($img_file) { $classfile = ROOT_PATH . 'lib/class/material.class.php'; if (is_file($classfile)) { class_exists('material') or (include $classfile); $material_pic = new material(); $img = array('Filedata' => $img_file); if (!$this->settings['App_material']) { return ''; } $img_info = $material_pic->addMaterial($img); $img_data = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename']); return maybe_serialize($img_data); } return ''; }
/** * 上传图片 */ public function upload() { if (!$_FILES['Filedata']) { $this->errorOutput(PARAM_WRONG); } $material = new material(); $result = $material->addMaterial($_FILES, '', '', '', '', 'png'); if (!$result) { $this->errorOutput(FAILED); } $flag = !!$this->input['flag']; if ($flag) { $picData = array('material_id' => $result['id'], 'name' => $result['name'], 'mark' => $result['mark'], 'type' => $result['type'], 'filesize' => $result['filesize'], 'imgwidth' => $result['imgwidth'], 'imgheight' => $result['imgheight'], 'host' => $result['host'], 'dir' => $result['dir'], 'filepath' => $result['filepath'], 'filename' => $result['filename'], 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'org_id' => $this->user['org_id'], 'create_time' => $result['create_time'], 'ip' => $result['ip']); $result = $this->api->create('app_material', $picData); } $this->addItem($result); $this->output(); }
public function update() { $starttime = explode('-', $this->input['astrostart']); $astrostart = mktime(0, 0, 0, $starttime[0], $starttime[1], 0); unset($starttime); $endtime = explode('-', $this->input['astroend']); $astroend = mktime(0, 0, 0, $endtime[0], $endtime[1], 0); unset($endtime); $data = array('id' => intval($this->input['id']), 'name' => trim($this->input['name']), 'astrointroduction' => trim($this->input['astrointroduction']), 'astrostart' => trim($astrostart), 'astroend' => trim($astroend)); if (!$data['id']) { $this->errorOutput("ID不能为空"); } if (!$data['name']) { $this->errorOutput("星座名不能为空"); } $sql = 'SELECT astroimg FROM ' . DB_PREFIX . 'astro_app_info WHERE id = ' . $data['id']; $res = $this->db->query_first($sql); $astroimg = unserialize($res['astroimg']) ? unserialize($res['astroimg']) : array(); $logo['Filedata'] = $_FILES['logo']; if ($logo['Filedata']) { include_once ROOT_PATH . 'lib/class/material.class.php'; $material = new material(); $re = $material->addMaterial($logo); $logo = array(); $logo = array('host' => $re['host'], 'dir' => $re['dir'], 'filepath' => $re['filepath'], 'filename' => $re['filename']); } else { $logo = $astroimg; } $where = ' WHERE 1 '; $where .= ' AND id = ' . $data['id']; $sql = 'UPDATE ' . DB_PREFIX . 'astro_app_info' . ' SET astrocn = "' . $data['name'] . '",astrointroduction = "' . $data['astrointroduction'] . '", astroimg ="' . addslashes(serialize($logo)) . '",astrostart = "' . $data['astrostart'] . '",astroend = "' . $data['astroend'] . '"' . $where; //$this->errorOutput($sql); $this->db->query($sql); $this->constellation->updatetime_orerid($data['id'], 'info'); $data['logo'] = $logo; $this->addItem($data); $this->output(); }
/** * 创建数据 */ public function create() { $category_id = intval($this->input['category_id']); $iconFiles = $_FILES['iconFiles']; if ($category_id <= 0 || empty($iconFiles)) { $this->errorOutput(PARAM_WRONG); } $_FILES['Filedata'] = $iconFiles; unset($_FILES['iconFiles']); $imgzip = $iconFiles['type'] == 'application/zip' ? 1 : 0; $material = new material(); $iconInfo = $material->addMaterial($_FILES, '', '', '', $imgzip); if (!$iconInfo) { $this->errorOutput(FAILED); } $data = array('cate_id' => $category_id, 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'org_id' => $this->user['org_id']); $condition = array('id' => $category_id); if ($imgzip) { foreach ($iconInfo as $icon) { $this->prepareData($data, $icon); $result = $this->api->create('app_material', $data); } //更新分类下图片数 $pic_count = count($iconInfo); $updateData = array('pic_count' => $pic_count); $this->api->update('icon_category', $updateData, $condition, true); } else { $this->prepareData($data, $iconInfo); $result = $this->api->create('app_material', $data); //更新分类下图片数 $updateData = array('pic_count' => 1); $this->api->update('icon_category', $updateData, $condition, true); } $this->addItem($result); $this->output(); }
/** * 图片上传 */ public function upload() { include_once ROOT_PATH . 'lib/class/material.class.php'; $material = new material(); $material_info = $material->addMaterial($_FILES); if (!$material_info) { $this->errorOutput(PARAM_WRONG); } $data = array('m_id' => $material_info['id'], 'host' => $material_info['host'], 'dir' => $material_info['dir'], 'filepath' => $material_info['filepath'], 'filename' => $material_info['filename'], 'type' => $material_info['type'], 'filesize' => $material_info['filesize'], 'user_id' => $this->user['user_id'], 'org_id' => $this->user['org_id'], 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'create_time' => TIMENOW, 'ip' => hg_getip()); $result = $this->company->create('material', $data); $return = array('id' => $result['id'], 'host' => $result['host'], 'dir' => $result['dir'], 'filepath' => $result['filepath'], 'filename' => $result['filename']); $this->addItem($return); $this->output(); }
/** * 上传引导图 */ public function upload_guide_pic() { if (!$_FILES['guide_pic']) { $this->errorOutput(PARAM_WRONG); } $material = new material(); $_FILES['Filedata'] = $_FILES['guide_pic']; unset($_FILES['guide_pic']); $pic_info = $material->addMaterial($_FILES, '', '', '', '', 'png'); if (!$pic_info) { $this->errorOutput(FAILED); } $data = array('info' => serialize($pic_info), 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'org_id' => $this->user['org_id'], 'create_time' => TIMENOW, 'ip' => hg_getip()); $result = $this->api->create('app_pic', $data); if ($result['id']) { $this->api->update('app_pic', array('sort_order' => $result['id']), array('id' => $result['id'])); $ret = array('id' => $result['id'], 'host' => $pic_info['host'], 'dir' => $pic_info['dir'], 'filepath' => $pic_info['filepath'], 'filename' => $pic_info['filename'], 'sort_order' => $result['id']); $this->addItem($ret); } $this->output(); }
protected function upload_indexpic() { include_once ROOT_PATH . 'lib/class/material.class.php'; $mat_server = new material(); if (!$_FILES['indexpic']['error']) { $file['Filedata'] = $_FILES['indexpic']; $material = $mat_server->addMaterial($file); //插入各类服务器 return $material; } }
/** * (图片|附件)上传 */ public function upload() { $material = new material(); $result = $material->addMaterial($_FILES); if (!$result) { $this->errorOutput(PARAM_WRONG); } return serialize($result); }
/** * 更新数据 */ public function update() { $id = intval($this->input['id']); if ($id <= 0) { $this->errorOutput(PARAM_WRONG); } $module_info = $this->api->detail('solidify_module', array('id' => $id)); if (!$module_info) { $this->errorOutput(PARAM_WRONG); } $data = $this->filter_data(); $validate = array(); if ($module_info['name'] != $data['name']) { //名称是否重复 $check = $this->api->verify(array('name' => $data['name'])); if ($check > 0) { $this->errorOutput(NAME_REPEAT); } $validate['name'] = $data['name']; } if ($module_info['mark'] != $data['mark']) { //标识是否重复 $check = $this->api->verify(array('mark' => $data['mark'])); if ($check > 0) { $this->errorOutput(MARK_EXISTS); } $validate['mark'] = $data['mark']; } if ($module_info['brief'] != $data['brief']) { $validate['brief'] = $data['brief']; } if ($module_info['sort_order'] != $data['sort_order']) { $validate['sort_order'] = $data['sort_order']; } if ($_FILES['module_icon']) { $_FILES['Filedata'] = $_FILES['module_icon']; unset($_FILES['module_icon']); $material = new material(); $pic_info = $material->addMaterial($_FILES); if ($pic_info) { $validate['pic'] = serialize($pic_info); } } if ($validate) { $result = $this->api->update('solidify_module', $validate, array('id' => $id)); } else { $result = true; } $this->addItem($result); $this->output(); }
/** * 更新相册 */ public function update() { $id = intval($this->input['id']); if ($id <= 0) { $this->errorOutput(PARAM_WRONG); } $albums_info = $this->api->detail(array('id' => $id)); if (!$albums_info) { $this->errorOutput(PARAM_WRONG); } $albums_name = trim(urldecode($this->input['albums_name'])); $updateData = array(); if ($albums_name != $albums_info['albums_name']) { if (empty($albums_name)) { $this->errorOutput(PARAM_WRONG); } //判断是否重名 $info = $this->api->detail(array('albums_name' => $albums_name, 'user_id' => $this->user['user_id']), 'id'); if ($info) { $this->errorOutput(NAME_EXISTS); } $updateData['albums_name'] = $albums_name; } if ($_FILES['Filedata']) { //上传相册封面 include_once ROOT_PATH . 'lib/class/material.class.php'; $material = new material(); $cover_info = $material->addMaterial($_FILES); $updateData['albums_cover'] = serialize($cover_info); } $cate_id = intval($this->input['cate_id']); if ($albums_info['cate_id'] != $cate_id) { if ($cate_id) { $info = $this->api->get_category($cate_id); if (!$info) { $this->errorOutput(PARAM_WRONG); } } $updateData['cate_id'] = $cate_id; } if ($updateData) { $result = $this->api->update('albums', $updateData, array('id' => $id)); //更新数据 if ($albums_info['cate_id']) { $this->api->update('category', array('albums_num' => -1), array('id' => $albums_info['cate_id']), true); } if ($updateData['cate_id']) { $this->api->update('category', array('albums_num' => 1), array('id' => $updateData['cate_id']), true); } if ($result) { $updateData['id'] = $id; $this->addItem($updateData); } } $this->output(); }
/** * * 图片上传,支持传参 ... * @param array $files $_FILES数组 * @param int $cid 编目内容id */ private function upload_img($files = array(), $cid = 0) { $id = $cid ? $cid : ($this->input['id'] ? intval($this->input['id']) : 0); $flag = $id ? 0 : 1; //判断是否临时数据 $file['Filedata'] = $files ? $files : $_FILES['Filedata']; if ($file['Filedata']) { if (!$this->settings['App_material'] && empty($files)) { $this->errorOutput('图片服务器未安装!'); } elseif (!$this->settings['App_material']) { return -1; //图片服务器未安装 } $material_pic = new material(); $img_info = $material_pic->addMaterial($file); $img_data = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename']); $data = $img_data; $data['cid'] = $id; $data['module'] = 1; $data['original_id'] = $img_info['id']; $data['type'] = $img_info['type']; $data['mark'] = 'img'; $data['imgwidth'] = $img_info['imgwidth']; $data['imgheight'] = $img_info['imgheight']; $data['flag'] = $flag; $vid = $this->db->insert_data($data, 'materials'); if ($vid && empty($files)) { $data['id'] = $vid; $this->addItem($data); $this->output(); } elseif ($vid) { $data['id'] = $vid; return $data; } } }
/** * 上传图片 * @param unknown $var_name * @return string */ private function uploadimg($file) { //处理avatar图片 if ($file) { $_FILES['Filedata'] = $file; $material = new material(); $img_info = $material->addMaterial($_FILES); if ($img_info) { $avatar = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename'], 'width' => $img_info['imgwidth'], 'height' => $img_info['imgheight'], 'id' => $img_info['id']); } } return $avatar; }
public function preview_pic() { $material_pic = new material(); if ($this->input['base64'] && $this->input['Filedata']) { //$img = base64_decode(str_replace('data:image/png;base64,', '', urldecode($this->input['Filedata']))); $info = $material_pic->imgdata2pic(urldecode($this->input['Filedata'])); $return = $info[0]['host'] . $info[0]['dir'] . $info[0]['filepath'] . $info[0]['filename']; } if ($_FILES['Filedata']) { $img_info = $material_pic->addMaterial($_FILES); $return = array('id' => $this->input['id'], 'img_path' => $img_info['url']); } $this->addItem($return); $this->output(); }
public function img_upload($img_file) { require_once ROOT_PATH . 'lib/class/material.class.php'; $img['Filedata'] = $img_file; if (!$this->settings['App_material']) { $this->errorOutput('图片服务器未安装!'); } $material_pic = new material(); $img_info = $material_pic->addMaterial($img); $img_data = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename']); return maybe_serialize($img_data); }
public function upload_water_img() { if (!$_FILES['Filedata']) { $this->errorOutput('请选择上传文件'); } $material_pic = new material(); $img_info = $material_pic->addMaterial($_FILES, 0); $img_thumb_info = hg_fetchimgurl($img_info, 160); $this->addItem(array('url' => $img_thumb_info)); $this->output(); }
/** * 上传logo * */ public function upload_img() { $logo['Filedata'] = $_FILES['logo']; if ($logo['Filedata']) { $material_pic = new material(); $logo_info = $material_pic->addMaterial($logo); $logo = array(); $logo_pic = array('host' => $logo_info['host'], 'dir' => $logo_info['dir'], 'filepath' => $logo_info['filepath'], 'filename' => $logo_info['filename'], 'imgwidth' => $logo_info['imgwidth'], 'imgheight' => $logo_info['imgheight']); $img_info = addslashes(serialize($logo_pic)); } if (!$logo_pic) { $this->errorOutput('没有上传的图片信息'); } $sql = " INSERT INTO " . DB_PREFIX . "material SET img_info = '" . $img_info . "'"; $query = $this->db->query($sql); $vid = $this->db->insert_id(); $data['id'] = $vid; $data['img_info'] = hg_fetchimgurl($logo_pic); $this->addItem($data); $this->output(); }
/** * 入素材库 * Enter description here ... * @param unknown_type $file * @param unknown_type $id */ public function add_material($file, $id) { include_once ROOT_PATH . 'lib/class/material.class.php'; $mMaterial = new material(); if (!$mMaterial) { return false; } $files['Filedata'] = $file; $material = $mMaterial->addMaterial($files, $id); $return = array(); if (!empty($material)) { $return['host'] = $material['host']; $return['dir'] = $material['dir']; $return['filepath'] = $material['filepath']; $return['filename'] = $material['filename']; } return $return; }
/** * 上传图片 */ public function upload() { $material = new material(); $result = $material->addMaterial($_FILES); if (!$result) { $this->errorOutput(PARAM_WRONG); } $picData = array('material_id' => $result['id'], 'name' => $result['name'], 'mark' => $result['mark'], 'type' => $result['type'], 'filesize' => $result['filesize'], 'imgwidth' => $result['imgwidth'], 'imgheight' => $result['imgheight'], 'host' => $result['host'], 'dir' => $result['dir'], 'filepath' => $result['filepath'], 'filename' => $result['filename'], 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'org_id' => $this->user['org_id'], 'create_time' => $result['create_time'], 'ip' => $result['ip']); return $this->api->create('app_material', $picData); }
$this->output(); } /** * 上传小组标识 */ public function upload() { include_once ROOT_PATH . 'lib/class/material.class.php'; $upload = new material(); $result = $upload->addMaterial($_FILES); $ret['data'] = serialize($result);
/** * 处理提交的数据 */ private function filter_data() { $name = isset($this->input['name']) ? trim(urldecode($this->input['name'])) : ''; $description = isset($this->input['description']) ? trim(urldecode($this->input['description'])) : ''; $isupdate = isset($this->input['isupdate']) ? intval($this->input['isupdate']) : 1; $creditshigher = isset($this->input['creditshigher']) ? intval($this->input['creditshigher']) : '0'; $starnum = isset($this->input['starnum']) ? intval($this->input['starnum']) : 0; $usernamecolor = isset($this->input['usernamecolor']) ? trim(urldecode($this->input['usernamecolor'])) : '#000000'; $enable = isset($this->input['enable']) ? intval($this->input['enable']) : '1'; //前台是否启用 if (empty($name)) { $this->errorOutput('用户组名称不能为空'); } if ($this->input['showcredit']) { if (empty($this->input['credits_rules_diy'])) { $this->errorOutput('如无需自定义规则,请<积分规则>选择否!'); } } if (!empty($usernamecolor)) { $_march = '/[^a-zA-Z]/is'; if (!preg_match($_march, $usernamecolor)) { $usernamecolor = color($usernamecolor); } $colorarr = str_split($usernamecolor); if (count($colorarr) > 7) { $this->errorOutput('十六进制色值不合法,大于7位'); } if ($colorarr[0] != '#') { $this->errorOutput('十六进制色值不合法,开头应该是以#'); } unset($colorarr[0]); foreach ($colorarr as $val) { if ($val >= 'A' && $val <= 'F' || $val >= '0' && $val <= '9' || $val >= 'a' && $val <= 'f') { continue; } else { $this->errorOutput('十六进制色值不合法,参考:#FF0000'); } } } $data = array('name' => $name, 'description' => $description, 'isupdate' => $isupdate, 'starnum' => $starnum, 'usernamecolor' => $usernamecolor, 'enable' => $enable); if (empty($isupdate)) { $data['creditshigher'] = $creditshigher; } if ($_FILES['icon']) { $img['Filedata'] = $_FILES['icon']; if (!$this->settings['App_material']) { $this->errorOutput('图片服务器未安装!'); } $material_pic = new material(); $img_info = $material_pic->addMaterial($img); $img_data = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename']); $data['icon'] = maybe_serialize($img_data); } elseif ($this->input['icondel']) { $data['icon'] = ''; } return $data; }
public function upload_material() { if (!$_FILES['Filedata']) { $this->errorOutput("素材内容不能为空"); } include_once ROOT_PATH . 'lib/class/material.class.php'; $material_server = new material(); $responce = $material_server->addMaterial($_FILES); if ($responce['ErrorCode'] || $responce['ErrorTexts']) { $this->errorOutput($responce['ErrorCode'] . $responce['ErrorTexts']); } $this->addItem($responce); $this->output(); }
/** * 上传图片 * @param unknown $var_name * @return string */ private function uploadimg($var_name) { if ($_FILES[$var_name]) { //处理avatar图片 if ($_FILES[$var_name] && !$_FILES[$var_name]['error']) { $_FILES['Filedata'] = $_FILES[$var_name]; $material = new material(); $img_info = $material->addMaterial($_FILES); if ($img_info) { $avatar = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename'], 'width' => $img_info['imgwidth'], 'height' => $img_info['imgheight'], 'id' => $img_info['id']); $avatar = @serialize($avatar); } } return $avatar; } }