protected function _initialize() { // 获取当前用户ID if (defined('UID')) { return; } define('UID', is_login()); if (!UID) { // 还没登录 跳转到登录页面 $this->redirect('Public/login'); } // js,css的版本 if (APP_DEBUG) { defined('SITE_VERSION') or define('SITE_VERSION', time()); } else { defined('SITE_VERSION') or define('SITE_VERSION', C('SYSTEM_UPDATRE_VERSION')); } //加载权限控制类 B('Admin\\Behavior\\AuthCheck'); //导航 $top = get_top_menu_name(CONTROLLER_NAME); $this->assign('topMenu', $top); //菜单 $this->assign('menus', dynamicMenu($top['id'], $top['pid'])); }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['name'])) { $this->error(L("ATTR_NAME_EMPTY_TIP")); } if (!check_empty($data['preset_value']) && $data['input_type'] == 1) { $this->error(L("PRESET_VALUE_EMPTY_TIP")); } // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("mail_server"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['smtp_server'])) { $this->error(L("SMTP_SERVER_EMPTY_TIP")); } if (!check_empty($data['smtp_name'])) { $this->error(L("SMTP_NAME_EMPTY_TIP")); } if (!check_empty($data['smtp_pwd'])) { $this->error(L("SMTP_PWD_EMPTY_TIP")); } // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['name'])) { $this->error(L("VOUCHER_NAME_EMPTY_TIP")); } if (doubleval($data['money']) <= 0) { $this->error(L("VOUCHER_MONEY_ERROR_TIP")); } $data['begin_time'] = trim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']); $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']); // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("use_limit", $data['use_limit']); //同步可用次数 M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("begin_time", $data['begin_time']); M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("end_time", $data['end_time']); M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("money", $data['money']); save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function insert() { B('FilterString'); $data = M("TagGroup")->create(); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/add")); if (!check_empty($data['name'])) { $this->error(L("TAGNAME_EMPTY_TIP")); } // 更新数据 $log_info = $data['name']; $list = M(MODULE_NAME)->add($data); if (false !== $list) { //成功提示 foreach ($_REQUEST['cate_id'] as $cate_id) { if (intval($cate_id) > 0) { $link_data = array(); $link_data['category_id'] = intval($cate_id); $link_data['tag_group_id'] = $list; M("TagGroupLink")->add($link_data); } } clear_auto_cache("store_filter_nav_cache"); save_log($log_info . L("INSERT_SUCCESS"), 1); $this->success(L("INSERT_SUCCESS")); } else { //错误提示 save_log($log_info . L("INSERT_FAILED"), 0); $this->error(L("INSERT_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = $data['id'] . l("TOPIC_DATA"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { rm_auto_cache("recommend_forum_topic"); M("TopicCateLink")->where("topic_id=" . $data['id'])->delete(); foreach ($_REQUEST['cate_id'] as $cate_id) { $link_data = array(); $link_data['cate_id'] = $cate_id; $link_data['topic_id'] = $data['id']; M("TopicCateLink")->add($link_data); } syn_topic_match($data['id']); //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function update() { B('FilterString'); $data = M("ApnsMessages")->create(); $log_info = $data['id']; //开始验证有效性 $this->assign("jumpUrl", u("MApns/edit", array("id" => $data['id']))); if (!check_empty($data['content'])) { $this->error(L("CONTENT_EMPTY_TIP")); } if ($data['send_time'] == '') { $data['send_time'] = get_gmtime(); } $data['send_time'] = to_timespan($data['send_time']); if (intval($_REQUEST['resend']) == 1) { $data['status'] = 0; } $list = M("ApnsMessages")->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['name'])) { $this->error(L("USER_GROUP_NAME_EMPTY_TIP")); } if ($data['discount'] <= 0 || $data['discount'] > 1) { $data['discount'] = 1; } // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 $dbErr = M()->getDbError(); save_log($log_info . L("UPDATE_FAILED") . $dbErr, 0); $this->error(L("UPDATE_FAILED") . $dbErr); } }
public function insert() { B('FilterString'); $data = M("PointGroup")->create(); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/add")); if (!check_empty($data['name'])) { $this->error(L("POINTNAME_EMPTY_TIP")); } if (M(MODULE_NAME)->where("`name`='" . $data['name'] . "'")->count() > 0) { $this->error(L("HAD_POINTGROUP")); } // 更新数据 $log_info = $data['name']; $list = M(MODULE_NAME)->add($data); if (false !== $list) { //成功提示 save_log($log_info . L("INSERT_SUCCESS"), 1); $this->success(L("INSERT_SUCCESS")); } else { //错误提示 save_log($log_info . L("INSERT_FAILED"), 0); $this->error(L("INSERT_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $user_names = preg_split("/[ ,]/i", $data['user_names']); $user_ids = ""; foreach ($user_names as $k => $v) { $uid = M("User")->where("user_name = '" . $v . "'")->getField("id"); if ($uid) { $user_ids .= $uid . "|"; } } $data['user_ids'] = $user_ids; $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['title'])) { $this->error(L("MSY_TITLE_EMPTY_TIP")); } if (!check_empty($data['content'])) { $this->error(L("MSY_CONTENT_EMPTY_TIP")); } // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function insert() { B('FilterString'); $ajax = intval($_REQUEST['ajax']); $data = M(MODULE_NAME)->create(); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/add")); if (!check_empty($data['name'])) { $this->error("请输入分类名称"); } $user_level_list = M(MODULE_NAME)->where("point=" . intval($data['point']))->find(); if ($user_level_list) { $this->error('已有相同的"所需信用值"'); } // 更新数据 $log_info = $data['name']; $list = M(MODULE_NAME)->add($data); if (false !== $list) { //成功提示 save_log($log_info . L("INSERT_SUCCESS"), 1); $this->success(L("INSERT_SUCCESS")); } else { //错误提示 save_log($log_info . L("INSERT_FAILED"), 0); $this->error(L("INSERT_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['name'])) { $this->error(L("BRAND_NAME_EMPTY_TIP")); } $data['begin_time'] = trim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']); $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']); // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //同步更新所有的产品 M("Deal")->where("brand_id=" . $data['id'] . " and brand_promote = 1")->setField("begin_time", $data['begin_time']); M("Deal")->where("brand_id=" . $data['id'] . " and brand_promote = 1")->setField("end_time", $data['end_time']); //成功提示 syn_brand_status($data['id']); clear_auto_cache("static_goods_info"); save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function run(&$params) { $ccmService = service('CouponCodeMall'); $ccmService->clearCache($params['id']); $params = null; B('CouponCodeMallRecs', $params); }
public function _initialize() { $action = array('permission' => array(), 'allow' => array('changecontent', 'listdialog', 'revert', 'adddialog', 'analytics', 'checkout', 'getmonthlyreceive', 'getyearreceivecomparison', 'getreceivablesmoney', 'getpayablesmoney')); B('Authenticate', $action); $this->type = trim($_GET['t']) ? trim($_GET['t']) : 'receivables'; if (!in_array($this->type, array('receivables', 'payables', 'receivingorder', 'paymentorder'))) { alert('error', L('PARAMETER_ERROR'), U('index/index')); } }
public function _initialize() { $action = array(); B('Admin\\Behaviors\\Authenticate', '', $action); //获取栏目信息 if (!($this->categorys = F('category_content'))) { D('ArticleCategory')->file_cache(); $this->categorys = F('category_content'); } }
/** * Perform on the logout view. We dont need any template to render. * * @return bool true */ function perform() { // each module can do clean up before logout // see modules/xxx/actions/class.xxx_sys_logout.php B('sys_logout'); // reload the main page header('Location: ' . SF_BASE_LOCATION . '/' . SF_CONTROLLER); exit; return TRUE; }
public function run(&$params) { $ccmService = service('TaoShop'); $ccmService->clearCache($params['id']); if (isset($params['seller_id'])) { $ccmService->clearItemsCache($params['seller_id']); } $params = null; B('TaoShopRecs', $params); }
public function index() { $Form = M("Form"); // 随便进行几个查询,来显示页面的SQL查询记录 $Form->select(); $Form->getById(1); $Form->field('id,title')->order('id desc')->select(); B('ShowRuntime'); //调用显示时间的行为 $this->display(); }
public function index() { $Form = M("Form"); // 随便进行几个查询,来显示页面的SQL查询记录 $Form->field('id,title')->order('id desc')->limit('0,6')->select(); $vo = $Form->find(); $Form->field('id,title')->order('id desc')->limit(3)->select(); // 调用ShowPageTrace行为 B('ShowPageTrace'); $this->display(); }
/** * 渲染模板输出 供render方法内部调用 * @access public * @param string $templateFile 模板文件 * @param mixed $var 模板变量 * @return string */ protected function renderFile($templateFile = '', $var = '') { ob_start(); ob_implicit_flush(0); if (!file_exists_case($templateFile)) { // 自动定位模板文件 $name = substr(get_class($this), 0, -6); $filename = empty($templateFile) ? $name : $templateFile; $templateFile = BASE_LIB_PATH . 'Widget/' . $name . 'Widget/' . $filename . C('TMPL_TEMPLATE_SUFFIX'); if (!file_exists_case($templateFile)) { throw_exception(L('_TEMPLATE_NOT_EXIST_') . '[' . $templateFile . ']'); } } $template = strtolower($this->template ? $this->template : (C('TMPL_ENGINE_TYPE') ? C('TMPL_ENGINE_TYPE') : 'php')); if ('php' == $template) { // 使用PHP模板 if (!empty($var)) { extract($var, EXTR_OVERWRITE); } // 直接载入PHP模板 include $templateFile; } elseif ('think' == $template) { // 采用Think模板引擎 if ($this->checkCache($templateFile)) { // 缓存有效 // 分解变量并载入模板缓存 extract($var, EXTR_OVERWRITE); //载入模版缓存文件 include C('CACHE_PATH') . md5($templateFile) . C('TMPL_CACHFILE_SUFFIX'); } else { // $tpl = Think::instance('ThinkTemplate'); // 编译并加载模板文件 //$tpl->fetch($templateFile,$var); $_data['file'] = $templateFile; $_data['var'] = $var; B('ParseTemplate', $_data); } } else { $class = 'Template' . ucwords($template); if (is_file(CORE_PATH . 'Driver/Template/' . $class . '.class.php')) { // 内置驱动 $path = CORE_PATH; } else { // 扩展驱动 $path = EXTEND_PATH; } require_cache($path . 'Driver/Template/' . $class . '.class.php'); $tpl = new $class(); $tpl->fetch($templateFile, $var); } $content = ob_get_clean(); return $content; }
public function update() { B('FilterString'); $submit = M("DarenSubmit")->getById(intval($_REQUEST['id'])); $user_info = M("User")->getById($submit['user_id']); $user_info['is_daren'] = 1; $user_info['daren_title'] = addslashes(htmlspecialchars(trim($_REQUEST['daren_title']))); M("User")->save($user_info); save_log($user_info['user_name'] . "被设为达人", 1); $submit['is_publish'] = 1; M("DarenSubmit")->save($submit); $this->success("审核成功"); }
/** * Perform on the logout view * * @return bool true */ function perform() { // each module can do clean up before logout // see modules/xxx/actions/class.xxx_sys_logout.php B('sys_logout'); if (SF_SECTION == 'admin') { header('Location: ' . SF_BASE_LOCATION . '/' . SF_CONTROLLER . '?admin=1'); } else { header('Location: ' . SF_BASE_LOCATION . '/' . SF_CONTROLLER); } exit; return TRUE; }
public function del() { if ($this->isAjax()) { $id = intval($_REQUEST['id']); if (M('tao_shop_category')->where("id='{$id}'")->delete()) { //清除缓存 $params = null; B('TaoShopCategory', $params); $this->ajaxReturn('', '', 1); } else { $this->ajaxReturn('', '删除失败', 0); } } }
public function insert() { B('FilterString'); $data = M("PointGroup")->create(); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/add")); if (!check_empty($data['name'])) { $this->error(L("POINTNAME_EMPTY_TIP")); } if (M(MODULE_NAME)->where("`name`='" . $data['name'] . "'")->count() > 0) { $this->error(L("HAD_POINTGROUP")); } // 更新数据 $log_info = $data['name']; $list = M(MODULE_NAME)->add($data); if (false !== $list) { foreach ($_REQUEST['cate_id'] as $cate_id) { if (intval($cate_id) > 0) { $link_data = array(); $link_data['category_id'] = intval($cate_id); $link_data['point_group_id'] = $list; M("PointGroupLink")->add($link_data); } } foreach ($_REQUEST['scate_id'] as $cate_id) { if (intval($cate_id) > 0) { $link_data = array(); $link_data['category_id'] = intval($cate_id); $link_data['point_group_id'] = $list; M("PointGroupSlink")->add($link_data); } } foreach ($_REQUEST['ecate_id'] as $cate_id) { if (intval($cate_id) > 0) { $link_data = array(); $link_data['category_id'] = intval($cate_id); $link_data['point_group_id'] = $list; M("PointGroupElink")->add($link_data); } } //成功提示 save_log($log_info . L("INSERT_SUCCESS"), 1); $this->success(L("INSERT_SUCCESS")); } else { //错误提示 save_log($log_info . L("INSERT_FAILED"), 0); $this->error(L("INSERT_FAILED")); } }
public function deleteImg() { B('FilterString'); $ajax = intval($_REQUEST['ajax']); $file = $_REQUEST['file']; $file = explode("..", $file); $file = $file[4]; $file = substr($file, 1); @unlink(get_real_path() . $file); if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] == 'ES_FILE') { $syn_url = $GLOBALS['distribution_cfg']['OSS_DOMAIN'] . "/es_file.php?username="******"&password="******"&path=" . $file . "&act=1"; @file_get_contents($syn_url); } save_log(l("DELETE_SUCCESS"), 1); $this->success(l("DELETE_SUCCESS"), $ajax); }
public function deleteImg() { B('FilterString'); $ajax = intval($_REQUEST['ajax']); $file = $_REQUEST['file']; $file = explode("..", $file); $file = $file[4]; $file = substr($file, 1); @unlink(get_real_path() . $file); if (app_conf("PUBLIC_DOMAIN_ROOT") != '') { $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&path=" . $file . "&act=1"; @file_get_contents($syn_url); } save_log(l("DELETE_SUCCESS"), 1); $this->success(l("DELETE_SUCCESS"), $ajax); }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/index", array("status" => $_REQUEST['f_status']))); // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($data['id'] . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($data['id'] . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $data['id'] . L("UPDATE_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['name'])) { $this->error(L("REGION_NAME_EMPTY_TIP")); } // 更新数据 $GLOBALS['db']->autoExecute(DB_PREFIX . "delivery_region", $data, "UPDATE", "id=" . $data['id']); $rs = $GLOBALS['db']->affected_rows(); if ($rs) { $this->updateRegionJS(); } save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); //开始验证有效性 //$this->assign("jumpUrl",u(MODULE_NAME."/edit",array("id"=>$data['id']))); print_r($data); die; // 更新数据 $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }
public function update() { B('FilterString'); $data = M(MODULE_NAME)->create(); $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title"); //开始验证有效性 $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id']))); if (!check_empty($data['title'])) { $this->error("请输入标题"); } $list = M(MODULE_NAME)->save($data); if (false !== $list) { //成功提示 save_log($log_info . L("UPDATE_SUCCESS"), 1); $this->success(L("UPDATE_SUCCESS")); } else { //错误提示 save_log($log_info . L("UPDATE_FAILED"), 0); $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED")); } }