/** * 清理缓存 */ public function clearOp() { if (!chksubmit()) { Tpl::showpage('cache.clear'); return; } $lang = Language::getLangContent(); // 清理所有缓存 if ($_POST['cls_full'] == 1) { foreach ($this->cacheItems as $i) { dkcache($i); } // 表主键 Model::dropTablePkArrayCache(); // 商品分类 dkcache('gc_class'); dkcache('all_categories'); dkcache('goods_class_seo'); dkcache('class_tag'); // 广告 Model('adv')->makeApAllCache(); // 首页 Model('web_config')->getWebHtml('index', 1); delCacheFile('index'); } else { $todo = (array) $_POST['cache']; foreach ($this->cacheItems as $i) { if (in_array($i, $todo)) { dkcache($i); } } // 表主键 if (in_array('table', $todo)) { Model::dropTablePkArrayCache(); } // 商品分类 if (in_array('goodsclass', $todo)) { dkcache('gc_class'); dkcache('all_categories'); dkcache('goods_class_seo'); dkcache('class_tag'); } // 广告 if (in_array('adv', $todo)) { Model('adv')->makeApAllCache(); } // 首页 if (in_array('index', $todo)) { Model('web_config')->getWebHtml('index', 1); delCacheFile('index'); } } $this->log(L('cache_cls_operate')); showMessage($lang['cache_cls_ok']); }
private function updateinfo($field, $id, $value) { $model_live_class = Model('live_class'); $res = $model_live_class->editLive_class(array('live_class_id' => $id), array($field => $value)); if ($res) { H('live_class', null); //清除缓存 delCacheFile('live_class'); $this->log('编辑抢购分类[ID:' . $id . ']', 1); echo 'true'; } else { echo 'false'; } exit; }
public function area_dropOp() { $model = Model(); $res = $model->table('live_area')->where(array('live_area_id' => array('in', intval($_POST['live_area_id']))))->delete(); if ($res) { H('city', null); //清除缓存 delCacheFile('city'); $this->log('删除线下抢区域[ID:' . intval($_POST['live_area_id']) . ']', 1); showMessage('删除成功', 'index.php?act=live_area', '', 'succ'); } else { showMessage('删除失败', 'index.php?act=live_area', '', 'error'); } }
/** * 清理缓存 */ public function clearOp() { $lang = Language::getLangContent(); if (chksubmit()) { //清理所有缓存 if ($_POST['cls_full'] == 1) { H('setting', true); H('goods_class', true); H('link', true); H('seo', true); H('goods_class_seo', true); H('class_tag', true); H('groupbuy', true); H('nav', true); H('express', true); H('store_class', true); H('store_grade', true); Model('adv')->cls(); delCacheFile('fields'); delCacheFile('index'); showMessage($lang['cache_cls_ok']); exit; } //清理基本缓存 if (@in_array('setting', $_POST['cache'])) { H('setting', true); } //清理商品分类,商品发布第一步中的搜索 缓存 if (@in_array('goodsclass', $_POST['cache'])) { H('goods_class', true); H('class_tag', true); } //清理广告 缓存 if (@in_array('adv', $_POST['cache'])) { Model('adv')->cls(); } //清理团购地区、分类、价格区间 缓存 if (@in_array('groupbuy', $_POST['cache'])) { H('groupbuy', true); } //清理底部导航 缓存 if (@in_array('nav', $_POST['cache'])) { H('nav', true); } //清理友情连接 缓存 if (@in_array('link', $_POST['cache'])) { H('link', true); } //清理首页缓存 if (@in_array('index', $_POST['cache'])) { delCacheFile('index'); } //清理TABLE缓存 if (@in_array('table', $_POST['cache'])) { delCacheFile('fields'); } //清理SEO缓存 if (@in_array('seo', $_POST['cache'])) { H('seo', true); H('goods_class_seo', true); } //清理快递公司 if (@in_array('express', $_POST['cache'])) { H('express', true); } //清理店铺分类 if (@in_array('store_class', $_POST['cache'])) { H('store_class', true); } //清理店铺等级 if (@in_array('store_grade', $_POST['cache'])) { H('store_grade', true); } showMessage($lang['cache_cls_ok']); } Tpl::showpage('cache.clear'); }
/** * 广告 * * @return array */ public function makeApAllCache() { if (C('cache_open')) { // *kcache() doesnt support iterating on keys } else { delCacheFile('adv'); } $model = Model(); $ap_list = $model->table('adv_position')->where(array('is_use' => 1))->select(); $adv_list = $model->table('adv')->where(array('adv_end_date' => array('gt', time())))->order('slide_sort, adv_id desc')->select(); $array = array(); foreach ((array) $ap_list as $v) { foreach ((array) $adv_list as $xv) { if ($v['ap_id'] == $xv['ap_id']) { $v['adv_list'][] = $xv; } } // 写入缓存 $apId = (int) $v['ap_id']; if (C('cache_open')) { wkcache("adv/{$apId}", $v); } else { write_file(BASE_DATA_PATH . '/cache/adv/' . $apId . '.php', $v); } } }
$tag[$n] = substrPro($tag[$n], 0, 15); $tag[$n] = mysql_real_escape_string($tag[$n]); if ($db->result($setting['db']['pre_sub'] . "news_tag", "id", array("tag", "=", $tag[$n]))) { $db->update($setting['db']['pre_sub'] . "news_tag", array("count" => "+1", "update_date" => "UNIX_TIMESTAMP()"), array("tag", "=", $tag[$n])); } else { $db->insert($setting['db']['pre_sub'] . "news_tag", array(0, $tag[$n], 1, 0, "UNIX_TIMESTAMP()", "UNIX_TIMESTAMP()")); } } $db->insert($setting['db']['pre_sub'] . "news_show", $_POST); $news_id = $db->GetInsertId(); } else { $log_info = $setting['language']['admin_art_content_edit']; unset($_POST['news_id']); $db->delete($setting['db']['pre_sub'] . "news_detail", array("news_id", "n=", $news_id)); $db->update($setting['db']['pre_sub'] . "news_show", $_POST, array("news_id", "n=", $news_id)); delCacheFile($news_id, $setting_sub["info"]['web_id']); } $cur_rec = array(); $max_count = count($sub_title); for ($i = 0; $i < $max_count; $i++) { $cur_rec['id'] = 0; $cur_rec['cat_id'] = $_POST['cat_id']; $cur_rec['news_id'] = $news_id; $cur_rec['page'] = $i + 1; $cur_rec['sub_title'] = $sub_title[$i]; $cur_rec['content'] = $content[$i]; $db->insert($setting['db']['pre_sub'] . "news_detail", $cur_rec); } $attach_list = explode("|", $attach_list); $condition = array(); for ($i = 0, $m = count($attach_list); $i < $m; $i++) {
/** * 清理所有广告缓存 * */ public function cls() { delCacheFile('adv'); // $adv = Model('adv'); $adv_info = $this->getList(); $ap_array = array(); foreach ($adv_info as $k => $v) { $ap_array[$v['ap_id']][] = $v; if ($v['adv_end_date'] > $time && $v['is_allow'] == '1') { $this->makeAdvCache($v); } } $ap_info = $this->getApList(); foreach ($ap_info as $k => $v) { $this->makeApCache($v, $ap_array[$v['ap_id']]); } }
/** * 广告 * * @return array */ public function makeApAllCache() { delCacheFile('adv'); $model = model(); $ap_list = $model->table('adv_position')->where(true)->select(); $adv_list = $model->table('adv')->where(true)->order('slide_sort, adv_id desc')->select(); $array = array(); foreach ((array) $ap_list as $v) { foreach ((array) $adv_list as $xv) { if ($v['ap_id'] == $xv['ap_id']) { $v['adv_list'][] = $xv; } } write_file(BASE_DATA_PATH . '/cache/adv/' . $v['ap_id'] . '.php', $v); } }
/** * 清理缓存 */ public function clearOp() { $lang = Language::getLangContent(); if (chksubmit()) { //清理所有缓存 if ($_POST['cls_full'] == 1) { H('setting', true); H('goods_class', true); H('seo', true); H('goods_class_seo', true); H('class_tag', true); H('groupbuy', true); H('nav', true); H('express', true); H('store_class', true); H('store_grade', true); H('circle_level', true); Model('adv')->makeApAllCache(); Model('web_config')->getWebHtml('index', 1); delCacheFile('fields'); delCacheFile('index'); showMessage($lang['cache_cls_ok']); exit; } //清理基本缓存 if (@in_array('setting', $_POST['cache'])) { H('setting', true); } //清理商品分类,商品发布第一步中的搜索 缓存 if (@in_array('goodsclass', $_POST['cache'])) { H('goods_class', true); H('class_tag', true); } //清理广告 缓存 if (@in_array('adv', $_POST['cache'])) { Model('adv')->makeApAllCache(); } //清理团购地区、分类、价格区间 缓存 if (@in_array('groupbuy', $_POST['cache'])) { H('groupbuy', true); } //清理底部导航 缓存 if (@in_array('nav', $_POST['cache'])) { H('nav', true); } //清理首页缓存 if (@in_array('index', $_POST['cache'])) { Model('web_config')->getWebHtml('index', 1); delCacheFile('index'); } //清理TABLE缓存 if (@in_array('table', $_POST['cache'])) { delCacheFile('fields'); } //清理SEO缓存 if (@in_array('seo', $_POST['cache'])) { H('seo', true); H('goods_class_seo', true); } //清理快递公司 if (@in_array('express', $_POST['cache'])) { H('express', true); } //清理店铺分类 if (@in_array('store_class', $_POST['cache'])) { H('store_class', true); } //清理店铺等级 if (@in_array('store_grade', $_POST['cache'])) { H('store_grade', true); } // Circle Member Level Cache Clearner if (@in_array('circle_level', $_POST['cache'])) { H('circle_level', true); } $this->log(L('cache_cls_operate')); showMessage($lang['cache_cls_ok']); } Tpl::showpage('cache.clear'); }
/** * 编辑分类 */ public function editOp() { $class_id = intval($_GET['class_id']); //取得一级分类列表 $store_model = Model('store_class'); $condition = array(); $condition['class_id'] = $class_id; $class_info = $store_model->getList($condition); Tpl::output('class_info', $class_info[0]); if (isset($_POST) && !empty($_POST)) { $obj_validate = new Validate(); $validate_array = array(array('input' => $_POST['class_name'], 'require' => 'true', "validator" => "Length", "min" => "1", "max" => "10", 'message' => Language::get('nc_store_class_name_error')), array('input' => $_POST['class_sort'], 'require' => 'true', 'validator' => 'Range', 'min' => 0, 'max' => 255, 'message' => Language::get('nc_store_class_sort_error'))); $obj_validate->validateparam = $validate_array; $error = $obj_validate->validate(); if ($error != '') { $this->showTip(Language::get('error') . $error, '', '', 'error'); } $param = array(); $param['class_name'] = trim($_POST['class_name']); $param['class_sort'] = intval($_POST['class_sort']); $param['class_recommend'] = intval($_POST['is_recommend']); $param['parent_class_id'] = intval($_POST['parent_class_id']); if (!empty($_FILES['class_image']['name'])) { $upload = new UploadFile(); $uploaddir = ATTACH_CLASS_PATH; $upload->set('default_dir', $uploaddir); $result = $upload->upfile('class_image'); if (!$result) { $this->showTip($upload->error); } $param['class_image'] = $upload->file_name; //删除老图片 //if(!empty($_POST['old_class_image'])) { // $old_image = BasePath.DS.ATTACH_OFFLINE.DS.$_POST['old_class_image']; // if(is_file($old_image)) { // unlink($old_image); // } //} } if (isset($_POST['class_id']) && intval($_POST['class_id']) > 0) { $result = $store_model->modify($param, array('class_id' => $_POST['class_id'])); } else { $result = $store_model->save($param); } if ($result) { delCacheFile('class'); $this->showTip(Language::get('nc_store_class_edit_succ'), 'index.php?act=store&op=storeclass'); } else { $this->showTip(Language::get('nc_store_class_edit_fail')); } } $condition = array(); $condition['parent_class_id'] = 0; $class_list = $store_model->getList($condition); //操作 Tpl::output('op', 'edit'); Tpl::output('list', $class_list); Tpl::showpage('storeclass.add'); }
public function edit_advOp() { if (isset($_POST) && !empty($_POST)) { //编辑广告位 $params = array(); $params['ap_name'] = trim($_POST['ap_name']); $params['ap_intro'] = trim($_POST['ap_intro']); $params['ap_class'] = trim($_POST['ap_class']); $params['ap_display'] = trim($_POST['ap_display']); $params['is_use'] = trim($_POST['is_use']); if ($_POST['ap_width_media'] != '') { $params['ap_width'] = intval(trim($_POST['ap_width_media'])); } if ($_POST['ap_height'] != '') { $params['ap_height'] = intval(trim($_POST['ap_height'])); } if ($_POST['ap_width_word'] != '') { $params['ap_word'] = intval(trim($_POST['ap_width_word'])); } if (!empty($_POST['ap_link'])) { $params['link'] = trim($_POST['ap_link']); } //上传广告位图片 if ($_FILES['default_pic']['name'] != '') { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_ADV_PATH); $result = $upload->upfile('default_pic'); if (!$result) { showMessage($upload->error, '', '', 'error'); } $params['default_content'] = $upload->file_name; } $condition = array('ap_id' => intval($_POST['ap_id'])); $model = Model(); $result = $model->table('adv_position')->where($condition)->update($params); if ($result) { delCacheFile('rec_position'); showMessage(L('nc_admin_website_adv_edit_succ'), 'index.php?act=adv', 'succ'); } else { showMessage(L('nc_admin_website_adv_edit_fail'), 'index.php?act=adv', 'error'); } } //获得广告位 $ap_id = intval($_GET['ap_id']); $model = Model(); $adv = $model->table('adv_position')->where(array('ap_id' => $ap_id))->find(); Tpl::output('adv', $adv); Tpl::showpage('adv_position.edit'); }
/** * 区域删除 */ public function area_dropOp() { $model = Model(); $result = $model->table('area')->where(array('area_id' => array('in', $_POST['area_id'])))->delete(); if ($result) { delCacheFile('city'); showMessage(Language::get('nc_admin_area_delete_success')); } else { showMessage(Language::get('nc_admin_area_delete_fail')); } }