public function set() { $module = $_REQUEST['module']; $privRoleObj = AdminPriv::getInstance(); if ($this->isPost()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } if ($privRoleObj->_update('module', $module, $_REQUEST['priv_roleid'])) { $this->assign('jumpUrl', $this->_refererUrl); $this->success('修改成功'); } else { $this->assign('jumpUrl', $this->_refererUrl); $this->success('修改失败'); } } $privs_conf = C('_privs_.Admin'); $module_privs = $privs_conf[$module]; $this->assign('module_privs', $module_privs); $this->assign('privs', $privRoleObj->getPrivs($module)); $this->assign('module', $module); $sysRoles = null; $roleModule = D('AdminRole'); $sysRoles = $roleModule->getAll(); $this->assign('sysRoles', $sysRoles); $this->assign('ur_href', '权限管理'); $this->assign('_hash_', buildFormToken()); $this->display(); }
public function index() { $page = isset($_REQUEST['page']) && $_REQUEST['page'] >= 1 ? $_REQUEST['page'] : 1; $pageLimit = 15; $localTimeObj = LocalTime::getInstance(); $uModel = D('User'); $params = array('nick' => isset($_REQUEST['nick']) && $_REQUEST['nick'] ? $_REQUEST['nick'] : ''); $res = $uModel->getAll($params, array('begin' => ($page - 1) * $pageLimit, 'offset' => $pageLimit)); $users = array(); foreach ($res['data'] as $rs) { $rs['last_login'] = $localTimeObj->local_date($this->_CFG['time_format'], $rs['last_login']); $users[] = $rs; } $this->assign('users', $users); $page_url = "?g=" . GROUP_NAME . "&m=" . MODULE_NAME . "&a=" . ACTION_NAME . "&page=[page]"; foreach ($params as $key => $val) { $page_url .= "&{$key}={$val}"; } $p = new Page($page, $pageLimit, $res['count'], $page_url, 5, 5); $pagelink = $p->showStyle(3); $this->assign('pagelink', $pagelink); $this->assign('_hash_', buildFormToken()); $this->assign('ur_href', '会员管理 > 会员列表'); $this->display(); }
/** * 系统设置 * */ public function setting() { if ($this->isPost()) { if (C('TOKEN_ON') && !checkFormToken($_POST)) { die('hack attemp.'); } /* 保存变量值 */ $count = count($_POST['value']); $configModel = M('site_config'); $arr = array(); $res = $configModel->field('id,value')->select(); foreach ($res as $row) { $arr[$row['id']] = $row['value']; } foreach ($_POST['value'] as $key => $val) { if ($arr[$key] != $val) { $configModel->where("id={$key}")->save(array('value' => trim($val))); } } F('site_config', null); $this->success('编辑成功'); } /* 可选语言 */ $_LANG = L('SysConfig'); $lang_list = array(); $this->assign('group_list', $this->_get_settings(null, null, $_LANG)); $this->assign('lang_list', array()); $this->assign('lang', $_LANG); $this->assign('ur_href', '系统管理 > 系统设置'); $this->assign('_hash_', buildFormToken()); $this->display(); }
public function index() { $nick = isset($_REQUEST['nick']) && $_REQUEST['nick'] ? $_REQUEST['nick'] : ''; $page = isset($_REQUEST['page']) && $_REQUEST['page'] >= 1 ? $_REQUEST['page'] : 1; $pageLimit = 15; $localTimeObj = LocalTime::getInstance(); $status_conf = PaymentConf::status_conf(); $where = "1=1"; if ($nick) { $where .= " AND nick LIKE '%{$_REQUEST['nick']}%'"; } $res = array('count' => 0, 'data' => array()); $res['count'] = M('payment')->where($where)->count(); $res['data'] = M('payment')->where($where)->order('id DESC')->limit(($page - 1) * $pageLimit . ",{$pageLimit}")->select(); $records = array(); foreach ($res['data'] as $rs) { $rs['addtime'] = $localTimeObj->local_date($this->_CFG['time_format'], $rs['addtime']); $rs['status_type'] = $status_conf[$rs['status']]; $records[] = $rs; } $this->assign('records', $records); $page_url = "?g=" . GROUP_NAME . "&m=" . MODULE_NAME . "&a=" . ACTION_NAME . "&page=[page]&nick={$nick}"; $p = new Page($page, $pageLimit, $res['count'], $page_url, 5, 5); $pagelink = $p->showStyle(3); $this->assign('pagelink', $pagelink); $this->assign('_hash_', buildFormToken()); $this->assign('ur_href', '充值管理 > 充值记录'); $this->display(); }
public function add() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $cid = intval($_REQUEST['id']); $name = $_REQUEST['name']; $data = array('cid' => $cid, 'name' => $name); if (M('tao_shop_category')->add($data)) { //清除缓存 $params = null; B('TaoShopCategory', $params); $this->ajaxReturn('', buildFormToken(), 1); } else { $this->ajaxReturn('', buildFormToken(), 0); } } import('@.Com.taobao.Taobao'); $taobaoObj = Taobao::getInstance(); $tao_shop_categorys = $taobaoObj->ShopCatesList(); $this->assign('tao_shop_categorys', $tao_shop_categorys); $this->assign('ur_href', '淘宝店铺分类管理 > 添加分类'); $this->assign('_hash_', buildFormToken()); $this->display(); }
/** * 清除今日以前的临时文件 * */ public function clean() { if ($this->isPost() && $this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_POST)) { die('hack attemp.'); } @set_time_limit(3600); if (function_exists('ini_set')) { ini_set('max_execution_time', 3600); ini_set("memory_limit", "256M"); } $localTimeObj = LocalTime::getInstance(); $today = $localTimeObj->local_strtotime(date('Y-m-d 00:00:00')); $upload_path = DOC_ROOT_PATH . get_upload_path(); $dir = $upload_path . 'temp/'; $dirhandle = opendir($dir); while (($file = readdir($dirhandle)) !== false) { if ($file != "." && $file != "..") { if (filemtime($dir . $file) < $today) { if (is_dir($dir . $file)) { del_dir($dir . $file); } else { @unlink($dir . $file); } } } } @closedir($dirhandle); $this->ajaxReturn('', buildFormToken(), 1); } }
/** * 设置 * */ public function setting() { if ($this->isPost()) { if (C('TOKEN_ON') && !checkFormToken($_POST)) { die('hack attemp.'); } $captcha = 0; $captcha = empty($_POST['captcha_register']) ? $captcha : $captcha | CAPTCHA_REGISTER; $captcha = empty($_POST['captcha_login']) ? $captcha : $captcha | CAPTCHA_LOGIN; $captcha = empty($_POST['captcha_comment']) ? $captcha : $captcha | CAPTCHA_COMMENT; $captcha = empty($_POST['captcha_tag']) ? $captcha : $captcha | CAPTCHA_TAG; $captcha = empty($_POST['captcha_admin']) ? $captcha : $captcha | CAPTCHA_ADMIN; $captcha = empty($_POST['captcha_login_fail']) ? $captcha : $captcha | CAPTCHA_LOGIN_FAIL; $captcha = empty($_POST['captcha_message']) ? $captcha : $captcha | CAPTCHA_MESSAGE; $captcha_width = empty($_POST['captcha_width']) ? 100 : intval($_POST['captcha_width']); $captcha_height = empty($_POST['captcha_height']) ? 30 : intval($_POST['captcha_height']); $m = M('site_config'); $m->where('code="captcha"')->save(array('value' => $captcha)); $m->where('code="captcha_width"')->save(array('value' => $captcha_width)); $m->where('code="captcha_height"')->save(array('value' => $captcha_height)); clear_all_caches(); $this->success('编辑成功'); } $res = M('site_config')->where('code="captcha"')->find(); $captcha = $res['value']; $captcha_check = array(); if ($captcha & CAPTCHA_REGISTER) { $captcha_check['register'] = 'checked="checked"'; } if ($captcha & CAPTCHA_LOGIN) { $captcha_check['login'] = '******'; } if ($captcha & CAPTCHA_COMMENT) { $captcha_check['comment'] = 'checked="checked"'; } if ($captcha & CAPTCHA_ADMIN) { $captcha_check['admin'] = 'checked="checked"'; } if ($captcha & CAPTCHA_MESSAGE) { $captcha_check['message'] = 'checked="checked"'; } if ($captcha & CAPTCHA_LOGIN_FAIL) { $captcha_check['login_fail_yes'] = 'checked="checked"'; } else { $captcha_check['login_fail_no'] = 'checked="checked"'; } $this->assign('captcha', $captcha_check); $res = M('site_config')->where('code="captcha_width"')->find(); $this->assign('captcha_width', $res['value']); $res = M('site_config')->where('code="captcha_height"')->find(); $this->assign('captcha_height', $res['value']); $this->assign('ur_href', '验证码管理 > 验证码设置'); $this->assign('_hash_', buildFormToken()); $this->display(); }
/** * 清除缓存 * */ public function clear() { if ($this->isPost() && $this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_POST)) { die('hack attemp.'); } set_time_limit(0); //清空数据缓存 clear_all_caches(); $this->ajaxReturn('', buildFormToken(), 1); } $this->assign('_hash_', buildFormToken()); $this->assign('ur_href', '清除系统缓存'); $this->display(); }
/** * 更新淘宝店铺全文索引 * */ public function updateTaoShop() { if ($this->isPost() && $this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_POST)) { die('hack attemp.'); } set_time_limit(0); $shopModel = D('TaoShop'); $shopModel->_updateFullIndex(); $this->ajaxReturn('', buildFormToken(), 1); } $this->assign('_hash_', buildFormToken()); $this->assign('ur_href', '更新淘宝店铺全文索引'); $this->display(); }
public function edit_pwd() { if ($this->isPost()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $auModel = D('AdminUsers'); $user_id = $_SESSION[C('SESSION_PREFIX') . 'user_id']; $auInfo = $auModel->info($user_id); if ($auInfo['password'] != md5(md5($_REQUEST['old_password']))) { $this->error('旧密码输入错误'); } $data = array('password' => md5(md5($_REQUEST['password']))); if ($auModel->edit_user($user_id, $data)) { $this->assign('jumpUrl', '?g=' . GROUP_NAME . '&m=User&a=logout'); $this->success('修改成功.请重新登陆'); } else { $this->error('修改失败,请重试'); } } $this->assign('ur_href', '修改密码'); $this->assign('_hash_', buildFormToken()); $this->display(); }
/** * 推荐店铺列表 * */ public function rec_shops() { $ccrsService = service('TaoShopRecs'); $shops = array(); $res = $ccrsService->getAll(); foreach ($res as $rs) { foreach ($rs as $r) { $pos = M('tao_shop_rec_pos')->where("id='{$r['position']}'")->find(); $r['position'] = $pos['name']; $shops[] = $r; } } $this->assign('shops', $shops); $this->assign('ur_href', '淘宝店铺管理 > 推荐店铺列表'); $this->assign('_hash_', buildFormToken()); $this->display(); }
public function del() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $id = intval($_REQUEST['id']); $ccmModel = D('MallPromotion'); if ($ccmModel->_delete($id)) { $this->ajaxReturn('', buildFormToken(), 1); } else { $this->ajaxReturn('', '删除失败', 0); } } }
/** * 删除管理员账户 * */ public function del() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $user_id = intval($_REQUEST['id']); $auModel = D('AdminUsers'); if ($auModel->_delete($user_id)) { //删除角色信息 $ausModel = D('AdminUserRole'); $ausModel->_del($user_id); $this->ajaxReturn('', buildFormToken(), 1); } else { $this->ajaxReturn('', '', 0); } } }
/** * 删除 * */ public function del() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $ad_id = intval($_REQUEST['ad_id']); $adModel = D('Ad'); $ad = $adModel->info($ad_id); if ($adModel->del($ad_id)) { $upload_path = DOC_ROOT_PATH . get_upload_path(); if (is_file($upload_path . $ad['ad_code'])) { @unlink($upload_path . $ad['ad_code']); } //更新缓存 $params = array('ad_id' => $ad_id); B('Adv', $params); $this->ajaxReturn('', buildFormToken(), 1); } else { $this->ajaxReturn('', '', 0); } } }
/** * 删除 * */ public function del() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $position_id = intval($_REQUEST['id']); $apModel = D('AdPosition'); if ($apModel->del($position_id)) { //删除模板 if (is_file(HTML_PATH . 'Adv/' . $position_id . '.html')) { @unlink(HTML_PATH . 'Adv/' . $position_id . '.html'); } //删除所有相关的广告 $adModel = D('Ad'); $ads = $adModel->getAdsByPositionId($position_id); $upload_path = DOC_ROOT_PATH . get_upload_path(); foreach ($ads as $a) { $ad = $adModel->info($a['ad_id']); if (is_file($upload_path . $ad['ad_code'])) { @unlink($upload_path . $ad['ad_code']); } $adModel->del($a['ad_id']); //更新缓存 $params = array('ad_id' => $a['ad_id']); B('Adv', $params); } //更新缓存 $params = array('pos_id' => $position_id); B('Adv', $params); $this->ajaxReturn('', buildFormToken(), 1); } else { $this->ajaxReturn('', '', 0); } } }
/** * 删除区域 * */ public function del_area() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $id = intval($_REQUEST['id']); $cityModel = D('City'); if ($cityModel->del_city($id)) { $this->ajaxReturn('', buildFormToken(), 1); } else { $this->ajaxReturn('', '', 0); } } }
public function import() { if (!is_file(LIB_PATH . 'ORG/phpExcel/PHPExcel.php')) { $this->error('请先上传PHPExcel类库'); } if ($this->isPost()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST, 'hash')) { die('hack attemp.'); } $m_id = intval($_REQUEST['m_id']); $m_name = $_REQUEST['m_name']; $import_format = $_REQUEST['import_format']; $file = ''; if ($_FILES['codes']['size'] > 0 && $_FILES['codes']['error'] == 0) { $upfile = array(); $upfile = upload_one_file($_FILES['codes']); if ($upfile['error']) { $this->error($upfile['error']); } $file = DOC_ROOT_PATH . get_upload_path() . $upfile['file_name']; } else { $this->error('Excel文件导入失败,请重试.'); } if (!is_file($file)) { $this->error('Excel文件导入失败,请重试.'); } $hanlder = "_import_coupons_" . $import_format . "_handler"; $this->{$hanlder}($m_id, $m_name, $file); $this->assign('jumpUrl', '?g=' . GROUP_NAME . '&m=' . MODULE_NAME); $this->success('导入成功'); } $this->assign('import_format_conf', $this->_import_format_conf); $this->assign('hash', buildFormToken('hash')); $this->assign('ur_href', '优惠券管理 > 批量导入'); $this->display(); }
/** * 推荐列表 * */ public function recs() { $ccrsService = service('TaoCouponRecs'); $coupons = array(); $res = $ccrsService->getAll(); foreach ($res as $rs) { foreach ($rs as $r) { $pos = M('tao_coupon_rec_pos')->where("id='{$r['position']}'")->find(); $r['position'] = $pos['name']; $coupons[] = $r; } } $this->assign('coupons', $coupons); $this->assign('ur_href', '淘宝优惠券管理 > 推荐优惠券列表'); $this->assign('_hash_', buildFormToken()); $this->display(); }
/** * 批量生成静态 * */ public function build_html() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } if (!$_REQUEST['id']) { $this->ajaxReturn('', '请选择文章', 0); } set_time_limit(0); $ids = explode(',', $_REQUEST['id']); foreach ($ids as $id) { $this->_buildHtml($id); } $this->ajaxReturn('', buildFormToken(), 1); } }
/** * 开放平台用户绑定帐号 * */ public function bind() { $type = $_REQUEST['type']; if (!in_array($type, C('OPEN_PLATFORM'))) { $this->error('参数错误'); } if (isset($_REQUEST['ac']) && $_REQUEST['ac'] == 'dobind') { if ($type == 'sina') { include_once DOC_ROOT_PATH . 'Addons/plugins/login/sina.class.php'; $sina = new sina(); //关注官方微博 $sina->follow_office(); $this->_on_sina_logined(); } elseif ($type == 'qq') { $this->_on_qq_logined(); } elseif ($type == 'taobao') { $this->_on_taobao_logined(); } } $nick = ''; if ($type == 'sina') { include_once DOC_ROOT_PATH . 'Addons/plugins/login/sina.class.php'; $sina = new sina(); $u_info = $sina->userInfo(); $nick = $u_info['screen_name']; } elseif ($type == 'qq') { include_once DOC_ROOT_PATH . 'Addons/plugins/login/qq.class.php'; $qq = new qq(); $u_info = $qq->userInfo(); $nick = $u_info['nickname']; } elseif ($type == 'taobao') { include_once DOC_ROOT_PATH . 'Addons/plugins/login/tb.class.php'; $tb = new tb(); $nick = $tb->get_openid(); } $this->assign('nick', $nick); $this->assign('type', $type); $this->assign('_hash_', buildFormToken()); $this->assign('hash', buildFormToken('hash')); $this->display(); }
public function del() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $role_id = intval($_REQUEST['id']); $arModel = D('AdminRole'); $role = $arModel->info($role_id); if (!$role) { $this->ajaxReturn('', 'id invalid', 0); } if ($arModel->del_role($role_id)) { $this->ajaxReturn('', buildFormToken(), 1); } else { $this->ajaxReturn('', '', 0); } } }
public function edit() { $id = intval($_REQUEST['id']); $cccService = service('CouponCodeCategory'); $category = $cccService->info($id); if ($this->isPost()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } if (!$_REQUEST['name'] || !$_REQUEST['sort_order']) { $this->error('请填写所有的必填项'); } $data = array('parent_id' => intval($_REQUEST['parent_id']), 'name' => $_REQUEST['name'], 'sort_order' => intval($_REQUEST['sort_order'])); $cccModel = D('CouponCodeCategory'); if ($cccModel->_edit($id, $data)) { //清除缓存 $params = null; B('CouponCodeCategory', $params); $this->assign('jumpUrl', '?g=' . GROUP_NAME . '&m=' . MODULE_NAME); $this->success('编辑成功'); } else { $this->error('编辑失败'); } } $categorys = array(); $data = $cccService->getTree(); foreach ($data as $rs) { $categorys[$rs['id']] = $rs; $categorys[$rs['id']]['prefix'] = str_repeat(" ", $rs['level']); } $this->assign('categorys', $categorys); $this->assign('category', $category); $this->assign('ur_href', '分类管理 > 编辑分类'); $this->assign('_hash_', buildFormToken()); $this->display('post'); }
public function del_category() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $id = intval($_REQUEST['id']); if (M('zhekou_category')->where("id='{$id}'")->delete()) { $params = array(); B('ZhekouCategory', $params); $this->ajaxReturn('', buildFormToken(), 1); } else { $this->ajaxReturn('', '删除失败', 0); } } }
/** * 删除 * */ public function del() { if ($this->isAjax()) { if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) { die('hack attemp.'); } $link_id = intval($_REQUEST['id']); $flModel = D('FriendLink'); $link = $flModel->info($link_id); if ($flModel->del($link_id)) { if (is_file(FixedUploadedFileUrl($link['link_code']))) { @unlink(FixedUploadedFileUrl($link['link_code'])); } $params = null; B('FriendLinks', $params); $this->ajaxReturn('', buildFormToken(), 1); } else { $this->ajaxReturn('', '', 0); } } }
/** * 推荐商家列表 * */ public function recs() { $mall_rec_position_conf = CouponCodeConf::mall_rec_position_conf(); $ccrsService = service('CouponCodeMallRecs'); $malls = array(); $res = $ccrsService->getAll(); foreach ($res as $rs) { foreach ($rs as $r) { $r['position'] = $mall_rec_position_conf[$r['position']]; $malls[] = $r; } } $this->assign('malls', $malls); $this->assign('ur_href', '商家管理 > 推荐商家列表'); $this->assign('_hash_', buildFormToken()); $this->display(); }