/** * 删除 */ public function del() { if ($this->sql->delete($this->in['name'])) { show_json($this->L['success']); } show_json($this->L['error'], false); }
public function _getData() { if (!$this->in['name'] || !$this->in['path'] || !$this->in['type']) { show_json($this->L["data_not_full"], false); } $in = array('mtime' => time(), 'sid' => $this->in['sid'], 'type' => $this->in['type'], 'path' => $this->in['path'], 'name' => $this->in['name'], 'time_to' => $this->in['time_to'] ? $this->in['time_to'] : '', 'share_password' => $this->in['share_password'] ? $this->in['share_password'] : '', 'code_read' => $this->in['code_read'] ? $this->in['code_read'] : '', 'not_download' => $this->in['not_download'] ? $this->in['not_download'] : ''); return $in; }
/** * 删除 */ public function del() { $name = $this->in['name']; if (!$name) { show_json($this->L["username_can_not_null"], false); } if ($name == 'admin') { show_json($this->L['default_user_can_not_do'], false); } if ($this->sql->delete($name)) { del_dir(USER_PATH . $name . '/'); show_json($this->L['success']); } show_json($this->L['error'], false); }
public function fileSave() { $filestr = rawurldecode($this->in['filestr']); $charset = $this->in['charset']; $path = _DIR($this->in['path']); if (!is_writable($path)) { show_json($this->L['no_permission'], false); } if ($charset != '' || $charset != 'utf-8') { $filestr = mb_convert_encoding($filestr, $this->in['charset'], 'utf-8'); } $fp = fopen($path, 'wb'); fwrite($fp, $filestr); fclose($fp); show_json($this->L['save_success']); }
public function index() { // Server Sent Event // header('Content-Type: text/event-stream'); header('Content-Type: text/octet-stream'); header('Cache-Control: no-cache'); $t1 = microtime(true); define('PROJECT_SITE_PATH', C('PROJECT.SITE_PATH') . '/' . $_GET['site']); define('PROJECT_MODULE_NAME', $_GET['module']); $path = PROJECT_SITE_PATH . '/' . C('PROJECT.SRC_DIR') . '/' . PROJECT_MODULE_NAME . '/' . C('M3D_FILENAME'); $tool = new PreprocessTool($path); $tool->run(); mark('处理完成!', 'emphasize'); $t2 = microtime(true); show_json('编译用时:' . round($t2 - $t1, 2) . 's'); }
/** * 参数设置 * 可以同时修改多个:key=a,b,c&value=1,2,3 */ public function set() { $key = $this->in['k']; $value = $this->in['v']; if ($key != '' && $value != '') { $conf = $this->config['user']; $arr_k = explode(',', $key); $arr_v = explode(',', $value); $num = count($arr_k); for ($i = 0; $i < $num; $i++) { $conf[$arr_k[$i]] = $arr_v[$i]; } fileCache::save($this->config['user_seting_file'], $conf); show_json($this->L["setting_success"]); } else { show_json($this->L['error'], false); } }
public function payResult($params) { global $_W; $fee = intval($params['fee']); $data = array('status' => $params['result'] == 'success' ? 1 : 0); $ordersn = $params['tid']; $order = pdo_fetch('select id,ordersn, price,openid,dispatchtype,addressid,carrier,status,isverify,deductcredit2,virtual from ' . tablename('ewei_shop_order') . ' where ordersn=:ordersn and uniacid=:uniacid limit 1', array(':uniacid' => $_W['uniacid'], ':ordersn' => $ordersn)); $orderid = $order['id']; if ($params['from'] == 'return') { $address = false; if (empty($order['dispatchtype'])) { $address = pdo_fetch('select realname,mobile,address from ' . tablename('ewei_shop_member_address') . ' where id=:id limit 1', array(':id' => $order['addressid'])); } $carrier = false; if ($order['dispatchtype'] == 1) { $carrier = unserialize($order['carrier']); } if ($params['type'] == 'cash') { show_json(2, array('order' => $order, 'address' => $address, 'carrier' => $carrier)); } else { if ($order['status'] == 0) { $pv = p('virtual'); if (!empty($order['virtual']) && $pv) { $pv->pay($order); } else { pdo_update('ewei_shop_order', array('status' => 1, 'paytime' => time()), array('id' => $orderid)); if ($order['deductcredit2'] > 0) { $shopset = m('common')->getSysset('shop'); m('member')->setCredit($order['openid'], 'credit2', -$order['deductcredit2'], array(0, $shopset['name'] . "余额抵扣: {$order['deductcredit2']} 订单号: " . $order['ordersn'])); } $this->setStocksAndCredits($orderid, 1); m('notice')->sendOrderMessage($orderid); if (p('commission')) { p('commission')->checkOrderPay($order['id']); } } } show_json(1, array('order' => $order, 'address' => $address, 'carrier' => $carrier, 'virtual' => $order['virtual'])); } } }
/** * 初始化数据 get * 只传键即可 &ext_not_allow=''&explorer-mkfile&explorer-pathRname */ private function _init_data() { if (strlen($this->in['role']) < 1) { show_json($this->L["groupname_can_not_null"], false); } if (strlen($this->in['name']) < 1) { show_json($this->L["groupdesc_can_not_null"], false); } $role_arr = array('role' => $this->in['role'], 'name' => $this->in['name']); $role_arr['ext_not_allow'] = $this->in['ext_not_allow']; foreach ($this->config['role_setting'] as $key => $actions) { foreach ($actions as $action) { $k = $key . ':' . $action; if (isset($this->in[$k])) { $role_arr[$k] = 1; } else { //$role_arr[$k] = 0; } } } return $role_arr; }
function upload_chunk($fileInput, $path = './', $temp_path) { global $config, $L; $file = $_FILES[$fileInput]; $chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0; $chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 1; if (!isset($file)) { show_json($L['upload_error_null'], false); } $file_name = iconv_system($file['name']); if ($chunks > 1) { //并发上传,不一定有前后顺序 $temp_file_pre = $temp_path . md5($temp_path . $file_name) . '.part'; if (get_filesize($file['tmp_name']) == 0) { show_json($L['upload_success'], false, 'chunk_' . $chunk . ' error!'); } if (move_uploaded_file($file['tmp_name'], $temp_file_pre . $chunk)) { $done = true; for ($index = 0; $index < $chunks; $index++) { if (!file_exists($temp_file_pre . $index)) { $done = false; break; } } if (!$done) { show_json($L['upload_success'], true, 'chunk_' . $chunk . ' success!'); } $save_path = $path . $file_name; $out = fopen($save_path, "wb"); if ($done && flock($out, LOCK_EX)) { for ($index = 0; $index < $chunks; $index++) { if (!($in = fopen($temp_file_pre . $index, "rb"))) { break; } while ($buff = fread($in, 4096)) { fwrite($out, $buff); } fclose($in); unlink($temp_file_pre . $index); } flock($out, LOCK_UN); fclose($out); } show_json($L['upload_success'], true, iconv_app($save_path)); } else { show_json($L['move_error'], false); } } //正常上传 $save_path = get_filename_auto($path . $file_name); //自动重命名 if (move_uploaded_file($file['tmp_name'], $save_path)) { show_json($L['upload_success'], true, iconv_app($save_path)); } else { show_json($L['move_error'], false); } }
/** * 获取商品数据 * * @param array $post POST数据 */ function API_GetGoods($post) { $pagesize = intval($_POST['PageSize']); $page = intval($_POST['Page']); if (empty($pagesize)) { $pagesize = 20; // 每页大小 } if ($page < 0) { $page = 0; } //$limit = ' LIMIT ' . ($page * $pagesize) . ', ' . ($pagesize+1); $today = gmtime(); $is_delete = 0; $record_count = $GLOBALS['db']->getOne("SELECT count(*) FROM " . $GLOBALS['ecs']->table('goods') . " WHERE is_delete='{$is_delete}' {$where} "); if ($page > floor($record_count / $pagesize)) { $page = $record_count / $pagesize; } $limit = ' LIMIT ' . $page * $pagesize . ', ' . $pagesize; $sql = "SELECT goods_id, cat_id, goods_name, goods_sn, brand_id, market_price, shop_price, promote_price, is_on_sale, is_alone_sale, is_best, is_new, is_hot, goods_number, goods_weight, integral, goods_brief, REPLACE(goods_desc, CONCAT(char(170), char(178)), '') AS goods_desc, goods_thumb, goods_img, promote_start_date, promote_end_date, " . " (promote_price > 0 AND promote_start_date <= '{$today}' AND promote_end_date >= '{$today}') AS is_promote, warn_number, keywords, extension_code, seller_note, give_integral " . " FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='{$is_delete}' {$where} ORDER BY goods_id DESC {$limit}"; $result = array(); $result['Data'] = $GLOBALS['db']->getAll($sql); $result['NextPage'] = false; $result['PrevPage'] = false; $result['RecordCount'] = $record_count; if ($page < floor($record_count / $pagesize)) { $result['NextPage'] = true; } if ($page > 0) { $result['PrevPage'] = true; } foreach ($result['Data'] as $key => $goods) { $result['Data'][$key]['is_on_sale'] = $goods['is_on_sale'] == 1; $result['Data'][$key]['is_alone_sale'] = $goods['is_alone_sale'] == 1; $result['Data'][$key]['is_best'] = $goods['is_best'] == 1; $result['Data'][$key]['is_new'] = $goods['is_new'] == 1; $result['Data'][$key]['is_hot'] = $goods['is_hot'] == 1; $result['Data'][$key]['is_promote'] = $goods['is_promote'] == 1; $result['Data'][$key]['goods_desc'] = htmlspecialchars($goods['goods_desc']); $result['Data'][$key]['keywords'] = htmlspecialchars($goods['keywords']); $result['Data'][$key]['promote_start_date'] = local_date('Y-m-d', $goods['promote_start_date']); $result['Data'][$key]['promote_end_date'] = local_date('Y-m-d', $goods['promote_end_date']); $tmp = array(); if ($goods['goods_thumb'] != '') { $tmp['Type'] = substr($goods['goods_thumb'], strrpos($goods['goods_thumb'], '.') + 1); $tmp['Data'] = get_goods_image_url($goods['goods_id'], $goods['goods_thumb'], true); } else { $tmp['Type'] = ''; $tmp['Data'] = ''; } $result['Data'][$key]['goods_thumb'] = $tmp; if ($goods['goods_img'] != '') { $tmp['Type'] = substr($goods['goods_img'], strrpos($goods['goods_img'], '.') + 1); $tmp['Data'] = get_goods_image_url($goods['goods_id'], $goods['goods_img'], false); } else { $tmp['Type'] = ''; $tmp['Data'] = ''; } $result['Data'][$key]['goods_img'] = $tmp; } show_json($GLOBALS['json'], $result, true); }
/** * save data; */ public static function save($file, $data) { //10000 need 6s if (!$file) { return; } if (file_exists($file) && !is_writable($file)) { show_json('the path "data/" can not write!', false); } if ($fp = fopen($file, "w")) { if (flock($fp, LOCK_EX)) { // Perform exclusive locking type $str = CONFIG_EXIT . json_encode($data); fwrite($fp, $str); fflush($fp); // flush output before releasing the lock flock($fp, LOCK_UN); // Release the lock } fclose($fp); } }
<?php //微赞科技 by QQ:800083075 http://www.012wz.com/ if (!defined('IN_IA')) { die('Access Denied'); } global $_W, $_GPC; $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display'; $openid = m('user')->getOpenid(); $uniacid = $_W['uniacid']; $orderid = intval($_GPC['id']); $order = pdo_fetch("select id,status,isverify,verified,verifycode from " . tablename('ewei_shop_order') . ' where id=:id and uniacid=:uniacid and openid=:openid limit 1', array(':id' => $orderid, ':uniacid' => $uniacid, ':openid' => $openid)); if (empty($order)) { show_json(0, '订单未找到!'); } $qrcode = $this->model->createQrcode($orderid); show_json(1, array('qrcode' => $qrcode, 'verifycode' => $order['verifycode']));
$status = 2; } } } if ($status == 2) { $update['eno'] = $this->model->createENO(); } } else { $status = 2; } $update['status'] = $status; pdo_update('ewei_shop_creditshop_log', $update, array('id' => $logid)); if ($status == 2) { $this->model->sendMessage($logid); } show_json($status); } } } } $_W['shopshare'] = array('title' => !empty($goods['share_title']) ? $goods['share_title'] : $goods['title'], 'imgUrl' => !empty($goods['share_icon']) ? tomedia($goods['share_icon']) : tomedia($goods['thumb']), 'link' => $this->createPluginMobileUrl('creditshop/detail', array('id' => $id)), 'desc' => !empty($goods['share_desc']) ? $goods['share_desc'] : $goods['title']); $com = p('commission'); if ($com) { $cset = $com->getSet(); if (!empty($cset)) { if ($member['isagent'] == 1 && $member['status'] == 1) { $_W['shopshare']['link'] = $this->createPluginMobileUrl('creditshop/detail', array('id' => $id, 'mid' => $member['id'])); if (empty($cset['become_reg']) && (empty($member['realname']) || empty($member['mobile']))) { $trigger = true; } } else {
exit; } $ps = array(); $ps['tid'] = $log['tid']; $ps['user'] = $openid; $ps['fee'] = $log['fee']; $ps['title'] = $log['title']; if ($type == 'credit') { $credits = m('member')->getCredit($openid, 'credit2'); if ($credits < $ps['fee']) { show_json(0, "余额不足,请充值"); } $fee = floatval($ps['fee']); $result = m('member')->setCredit($openid, 'credit2', -$fee, array($_W['member']['uid'], '消费' . $setting['creditbehaviors']['currency'] . ':' . $fee)); if (is_error($result)) { show_json(0, $result['message']); } $record = array(); $record['status'] = '1'; $record['type'] = 'cash'; pdo_update('core_paylog', $record, array('plid' => $log['plid'])); pdo_update('ewei_shop_order', array('paytype' => 1), array('id' => $order['id'])); $ret = array(); $ret['result'] = 'success'; $ret['type'] = $log['type']; $ret['from'] = 'return'; $ret['tid'] = $log['tid']; $ret['user'] = $log['openid']; $ret['fee'] = $log['fee']; $ret['weid'] = $log['weid']; $ret['uniacid'] = $log['uniacid'];
/** * 权限验证;统一入口检验 */ public function authCheck() { if (isset($GLOBALS['is_root']) && $GLOBALS['is_root'] == 1) { return; } if (in_array(ACT, $this->notCheck)) { return; } if (!array_key_exists(ST, $this->config['role_setting'])) { return; } if (!in_array(ACT, $this->config['role_setting'][ST])) { return; } //有权限限制的函数 $key = ST . ':' . ACT; $group = new fileCache($this->config['system_file']['group']); $GLOBALS['auth'] = $auth = $group->get($this->user['role']); //默认扩张功能等价权限 $auth['explorer:pathChmod'] = $auth['explorer:pathRname']; $auth['explorer:pathCopyDrag'] = $auth['explorer:pathCuteDrag']; if ($auth[$key] !== 1) { show_json($this->L['no_permission'], false); } //扩展名限制:新建文件&上传文件&重命名文件&保存文件&zip解压文件 $check_arr = array('mkfile' => isset($this->in['path']) ? $this->in['path'] : '', 'pathRname' => isset($this->in['rname_to']) ? $this->in['rname_to'] : '', 'fileUpload' => isset($_FILES['file']['name']) ? $_FILES['file']['name'] : '', 'fileSave' => isset($this->in['path']) ? $this->in['path'] : ''); if (array_key_exists(ACT, $check_arr) && !checkExt($check_arr[ACT])) { show_json($this->L['no_permission_ext'], false); } }
<?php if (!defined('IN_IA')) { exit('Access Denied'); } global $_W, $_GPC; $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'index'; $openid = m('user')->getOpenid(); $uniacid = $_W['uniacid']; $set = m('common')->getSysset('shop'); $commission = p('commission'); if ($commission) { $shopid = intval($_GPC['shopid']); if (!empty($shopid)) { $myshop = set_medias($commission->getShop($shopid), array('img', 'logo')); } } if ($_W['isajax']) { $args = array('pagesize' => 10, 'page' => $_GPC['page'], 'isnew' => $_GPC['isnew'], 'ishot' => $_GPC['ishot'], 'isrecommand' => $_GPC['isrecommand'], 'isdiscount' => $_GPC['isdiscount'], 'istime' => $_GPC['istime'], 'keywords' => $_GPC['keywords'], 'pcate' => $_GPC['pcate'], 'ccate' => $_GPC['ccate'], 'tcate' => $_GPC['tcate'], 'order' => $_GPC['order'], 'by' => $_GPC['by']); if (!empty($myshop['selectgoods']) && !empty($myshop['goodsids'])) { $args['ids'] = $myshop['goodsids']; } $goods = m('goods')->getList($args); show_json(1, array('goods' => $goods, 'pagesize' => $args['pagesize'])); } include $this->template('shop/list');
if (empty($item)) { message('抱歉,您的订单不存或是已经被取消!', $this->createMobileUrl('myorder'), 'error'); } $goodsid = pdo_fetch("SELECT goodsid,total FROM " . tablename('ewei_shop_order_goods') . " WHERE orderid = '{$orderid}'", array(), 'goodsid'); $goods = pdo_fetchall("SELECT g.id, g.title, g.thumb, g.unit, g.marketprice, o.total,o.optionid FROM " . tablename('ewei_shop_order_goods') . " o left join " . tablename('shopping_goods') . " g on o.goodsid=g.id " . " WHERE o.orderid='{$orderid}'"); $goods = set_medias($goods, 'thumb'); foreach ($goods as &$g) { $option = pdo_fetch("select title,marketprice,weight,stock from " . tablename("shopping_goods_option") . " where id=:id limit 1", array(":id" => $g['optionid'])); if ($option) { $g['title'] = "[" . $option['title'] . "]" . $g['title']; $g['marketprice'] = $option['marketprice']; } } unset($g); $dispatch = pdo_fetch("select id,dispatchname from " . tablename('shopping_dispatch') . " where id=:id limit 1", array(":id" => $item['dispatch'])); show_json(1, array('goods' => $goods, 'dispatch' => $dispatch)); } else { if ($operation == 'confirm') { $orderid = intval($_GPC['orderid']); $order = pdo_fetch("SELECT status FROM " . tablename('ewei_shop_order') . " WHERE id = :id AND from_user = :from_user", array(':id' => $orderid, ':from_user' => $_W['fans']['from_user'])); if (empty($order)) { showmessage('抱歉,订单不存在或是已经被取消!', $this->createMobileUrl('myorder'), 'error'); } if ($order['status'] != 2) { showmessage('订单未支付,无法进行收货!', $this->createMobileUrl('shop/order', null, true), 'error'); } pdo_update('ewei_shop_order', array('status' => 3), array('uniacid' => $_W['uniacid'], 'id' => $orderid, 'openid' => $openid)); showmessage('确认收货完成!', $this->createMobileUrl('order'), 'success'); } elseif ($operation == 'cancel') { $orderid = intval($_GPC['orderid']); $order = pdo_fetch("SELECT status FROM " . tablename('ewei_shop_order') . " WHERE id = :id AND from_user = :from_user", array(':id' => $orderid, ':from_user' => $_W['fans']['from_user']));
/** * 上传,html5拖拽 flash 多文件 */ public function fileUpload() { $save_path = $this->path; if ($save_path == '') { show_json($this->L['upload_error_big'], false); } if (strlen($this->in['fullPath']) > 1) { //folder drag upload $full_path = _DIR_CLEAR(rawurldecode($this->in['fullPath'])); $full_path = get_path_father($full_path); $full_path = iconv_system($full_path); if (mk_dir($save_path . $full_path)) { $save_path = $save_path . $full_path; } } upload('file', $save_path); }
} } } if ($level >= 3) { if ($member['level2'] > 0) { $level3_orders = pdo_fetchall('select distinct o.id from ' . tablename('ewei_shop_order') . ' o ' . ' left join ' . tablename('ewei_shop_order_goods') . ' og on og.orderid=o.id ' . " where o.agentid in( " . implode(',', array_keys($member['level2_agentids'])) . ") and o.status>=3 and og.status3=0 and ({$time} - o.createtime > {$day_times}) and o.uniacid=:uniacid group by o.id", array(':uniacid' => $_W['uniacid'])); foreach ($level3_orders as $o) { if (empty($o['id'])) { continue; } $orderids[] = array('orderid' => $o['id'], 'level' => 3); } } } $time = time(); foreach ($orderids as $o) { pdo_update('ewei_shop_order_goods', array('status' . $o['level'] => 1, 'applytime' . $o['level'] => $time), array('orderid' => $o['orderid'], 'uniacid' => $_W['uniacid'])); } $applyno = m('common')->createNO('commission_apply', 'applyno', 'CA'); $apply = array('uniacid' => $_W['uniacid'], 'applyno' => $applyno, 'orderids' => iserializer($orderids), 'mid' => $member['id'], 'commission' => $commission_ok, 'type' => intval($_GPC['type']), 'status' => 1, 'applytime' => $time); pdo_insert('ewei_shop_commission_apply', $apply); $returnurl = urlencode($this->createMobileUrl('member/withdraw')); $infourl = $this->createMobileUrl('member/info', array('returnurl' => $returnurl)); $this->model->sendMessage($openid, array('commission' => $commission_ok, 'type' => $apply['type'] == 1 ? '微信' : '余额'), TM_COMMISSION_APPLY); show_json(1, '已提交,请等待审核!'); } $returnurl = urlencode($this->createPluginMobileUrl('commission/apply')); $infourl = $this->createMobileUrl('member/info', array('returnurl' => $returnurl)); show_json(1, array('commission_ok' => $member['commission_ok'], 'cansettle' => $cansettle, 'member' => $member, 'set' => $this->set, 'infourl' => $infourl, 'noinfo' => empty($member['realname']))); } include $this->template('apply');
public function setConfig() { $file = USER . 'data/editor_config.php'; if (!is_writeable($file)) { //配置不可写 show_json($this->L['no_permission_write_file'], false); } $key = $this->in['k']; $value = $this->in['v']; if ($key != '' && $value != '') { $sql = new fileCache($file); if (!$sql->update($key, $value)) { $sql->add($key, $value); //没有则添加一条 } show_json($this->L["setting_success"]); } else { show_json($this->L['error'], false); } }
$g['content'] = $g['content' . $row['level']]; $g['level'] = $row['level']; if ($row['level'] == 1) { $g['level'] = '一'; } else { if ($row['level'] == 2) { $g['level'] = '二'; } else { if ($row['level'] == 3) { $g['level'] = '三'; } } } } unset($g); $row['goods'] = $goods; $row['ordercommission'] = $ordercommission; $row['orderpay'] = $orderpay; } unset($row); show_json(1, array('list' => $list, 'pagesize' => $psize, 'totalcommission' => $totalcommission)); } } } } if ($operation == 'display') { include $this->template('log'); } if ($operation == 'detail') { include $this->template('log_detail'); }
/** * 权限验证;统一入口检验 */ public function authCheck() { if (isset($GLOBALS['is_root']) && $GLOBALS['is_root'] == 1) { return; } if (in_array(ACT, $this->notCheck)) { return; } if (!array_key_exists(ST, $this->config['role_setting'])) { return; } if (!in_array(ACT, $this->config['role_setting'][ST]) && ST . ':' . ACT != 'user:common_js') { return; } //输出处理过的权限 //有权限限制的函数 $key = ST . ':' . ACT; $group = new fileCache(USER_SYSTEM . 'group.php'); $auth = $group->get($this->user['role']); //向下版本兼容处理 //未定义;新版本首次使用默认开放的功能 if (!isset($auth['userShare:set'])) { $auth['userShare:set'] = 1; } if (!isset($auth['explorer:fileDownload'])) { $auth['explorer:fileDownload'] = 1; } //默认扩展功能 等价权限 $auth['user:common_js'] = 1; //权限数据配置后输出到前端 $auth['explorer:pathChmod'] = $auth['explorer:pathRname']; $auth['explorer:pathDeleteRecycle'] = $auth['explorer:pathDelete']; $auth['explorer:pathCopyDrag'] = $auth['explorer:pathCuteDrag']; $auth['explorer:fileDownloadRemove'] = $auth['explorer:fileDownload']; $auth['explorer:zipDownload'] = $auth['explorer:fileDownload']; $auth['explorer:fileProxy'] = $auth['explorer:fileDownload']; $auth['editor:fileGet'] = $auth['explorer:fileDownload']; $auth['explorer:officeView'] = $auth['explorer:fileDownload']; $auth['explorer:officeSave'] = $auth['editor:fileSave']; $auth['userShare:del'] = $auth['userShare:set']; if ($auth[$key] != 1) { show_json($this->L['no_permission'], false); } $GLOBALS['auth'] = $auth; //全局 //扩展名限制:新建文件&上传文件&重命名文件&保存文件&zip解压文件 $check_arr = array('mkfile' => $this->check_key('path'), 'pathRname' => $this->check_key('rname_to'), 'fileUpload' => isset($_FILES['file']['name']) ? $_FILES['file']['name'] : '', 'fileSave' => $this->check_key('path')); if (array_key_exists(ACT, $check_arr) && !checkExt($check_arr[ACT])) { show_json($this->L['no_permission_ext'], false); } }
public function get_url_title() { $html = curl_get_contents($this->in['url']); $result = match($html, "<title>(.*)<\\/title>"); if (strlen($result) > 50) { $result = mb_substr($result, 0, 50, 'utf-8'); } if (!$result || strlen($result) == 0) { $result = $this->in['url']; $result = str_replace(array('http://', '&', '/'), array('', '@', '-'), $result); } show_json($result); }
/** * 权限验证;统一入口检验 */ public function authCheck() { if ($GLOBALS['is_root'] == 1) { return; } if (ACT == 'loginSubmit' || ACT == 'checkCode') { return; } if (!array_key_exists(ST, $this->config['role_setting'])) { return; } else { if (!in_array(ACT, $this->config['role_setting'][ST])) { return; } else { //有权限限制的函数 $key = ST . ':' . ACT; $group = new fileCache($this->config['system_file']['group']); $GLOBALS['auth'] = $auth = $group->get($this->user['role']); if ($auth[$key] !== 1) { show_json($this->L['no_permission'], false); } //扩展名限制:新建文件&上传文件&重命名文件&保存文件&zip解压文件 $check_arr = array('mkfile' => $this->in['path'], 'pathRname' => $this->in['rname_to'], 'fileUpload' => $_FILES['file']['name'], 'fileSave' => $this->in['path']); if (array_key_exists(ACT, $check_arr)) { $ext = get_path_ext($check_arr[ACT]); $ext_arr = explode('|', $auth['ext_not_allow']); if (in_array($ext, $ext_arr)) { show_json($this->L['no_permission_ext'], false); } } } } return; }
/** * 上传,html5拖拽 flash 多文件 */ public function fileUpload() { //show('error',false); $save_path = $this->path; if (!is_writeable($save_path)) { show_json($this->L['no_permission_write'], false); } if ($save_path == '') { show_json($this->L['upload_error_big'], false); } if (strlen($this->in['fullPath']) > 1) { //folder drag upload $full_path = _DIR_CLEAR(rawurldecode($this->in['fullPath'])); $full_path = get_path_father($full_path); $full_path = iconv_system($full_path); if (mk_dir($save_path . $full_path)) { $save_path = $save_path . $full_path; } } //upload('file',$save_path); //分片上传 $temp_dir = USER_TEMP; mk_dir($temp_dir); if (!is_writeable($temp_dir)) { show_json($this->L['no_permission_write'], false); } upload_chunk('file', $save_path, $temp_dir); }
public function fileGet() { $name = $this->_clear($this->in['filename']); $filename = $this->share_path . $name; if (filesize($filename) >= 1024 * 1024 * 20) { show_json($this->L['edit_too_big'], false); } $filecontents = file_get_contents($filename); //文件内容 $charset = $this->_get_charset($filecontents); if ($charset != '' || $charset != 'utf-8') { $filecontents = mb_convert_encoding($filecontents, 'utf-8', $charset); } $data = array('ext' => get_path_ext($name), 'name' => iconv_app($name), 'filename' => $name, 'charset' => $charset, 'content' => $filecontents); show_json($data); }
/** * 文件上传处理。单个文件上传,多个分多次请求 * 调用demo * upload('file','D:/www/'); */ function upload($fileInput, $path = './') { global $config, $L; $file = $_FILES[$fileInput]; if (!isset($file)) { show_json($L['upload_error_null'], false); } $file_name = iconv_system($file['name']); $info = _upload($file['tmp_name'], $file['size'], $path . $file_name); show_json($info['data'], $info['code'], $info['path']); }
$shopdata['uniacid'] = $_W['uniacid']; $shopdata['mid'] = $member['id']; if (is_array($_GPC['goodsids'])) { $shopdata['goodsids'] = implode(",", $_GPC['goodsids']); } if (!empty($shopdata['selectgoods']) && !is_array($_GPC['goodsids'])) { show_json(0, '请选择商品!'); } if (empty($shop['id'])) { pdo_insert('ewei_shop_commission_shop', $shopdata); } else { pdo_update('ewei_shop_commission_shop', $shopdata, array('id' => $shop['id'])); } show_json(1); } $goods = array(); if (!empty($shop['selectgoods'])) { $goodsids = explode(',', $shop['goodsids']); if (!empty($goodsids)) { $goods = pdo_fetchall('select id,title,marketprice,thumb from ' . tablename('ewei_shop_goods') . ' where uniacid=:uniacid and id in ( ' . trim($shop['goodsids']) . ')', array(':uniacid' => $_W['uniacid'])); $goods = set_medias($goods, 'thumb'); } } show_json(1, array('shop' => $shop, 'goods' => $goods)); } $set = m('common')->getSysset('shop'); include $this->template('myshop_select'); } } } }
if (empty($goods)) { show_json(0, '商品未找到'); } $data = pdo_fetch('select id,deleted from ' . tablename('ewei_shop_member_favorite') . ' where uniacid=:uniacid and goodsid=:id and openid=:openid limit 1', array(':uniacid' => $_W['uniacid'], ':openid' => $openid, ':id' => $id)); if (empty($data)) { $data = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'goodsid' => $id, 'createtime' => time()); pdo_insert('ewei_shop_member_favorite', $data); show_json(1, array('isfavorite' => true)); } else { if (empty($data['deleted'])) { pdo_update('ewei_shop_member_favorite', array('deleted' => 1), array('id' => $data['id'], 'uniacid' => $_W['uniacid'], 'openid' => $openid)); show_json(1, array('isfavorite' => false)); } else { pdo_update('ewei_shop_member_favorite', array('deleted' => 0), array('id' => $data['id'], 'uniacid' => $_W['uniacid'], 'openid' => $openid)); show_json(1, array('isfavorite' => true)); } } } else { if ($operation == 'remove' && $_W['ispost']) { $ids = $_GPC['ids']; if (empty($ids) || !is_array($ids)) { show_json(0, '参数错误'); } $sql = "update " . tablename('ewei_shop_member_favorite') . ' set deleted=1 where uniacid=:uniacid and openid=:openid and id in (' . implode(',', $ids) . ')'; pdo_query($sql, array(':uniacid' => $uniacid, ':openid' => $openid)); show_json(1); } } } } include $this->template('shop/favorite');
global $_W, $_GPC; $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display'; $openid = m('user')->getOpenid(); if ($_W['isajax']) { if ($operation == 'display') { $pindex = max(1, intval($_GPC['page'])); $psize = 10; $condition = ' and `uniacid` = :uniacid and status=1'; $params = array(':uniacid' => $_W['uniacid']); $sql = 'SELECT COUNT(*) FROM ' . tablename('ewei_shop_notice') . " where 1 {$condition}"; $total = pdo_fetchcolumn($sql, $params); $sql = 'SELECT * FROM ' . tablename('ewei_shop_notice') . ' where 1 ' . $condition . ' ORDER BY displayorder desc,createtime desc LIMIT ' . ($pindex - 1) * $psize . ',' . $psize; $list = pdo_fetchall($sql, $params); foreach ($list as &$row) { $row['createtime'] = date('Y-m-d H:i', $row['createtime']); } unset($row); $list = set_medias($list, 'thumb'); show_json(1, array('list' => $list, 'pagesize' => $psize)); } else { if ($operation == 'get') { $id = intval($_GPC['id']); $data = pdo_fetch('select * from ' . tablename('ewei_shop_notice') . ' where uniacid=:uniacid and id=:id and status=1 limit 1', array(':uniacid' => $_W['uniacid'], ':id' => $id)); if (!empty($data)) { $data['createtime'] = date('Y-m-d H:i', $data['createtime']); } show_json(1, array('notice' => $data)); } } } include $this->template('shop/notice');