function getDataTemp($share) { $typeId = $share['typeId']; $cache = ts_cache('share_types'); if (empty($cache)) { $cache = type_cache(); } $temp = $cache[$typeId]['temp_list']; $data = unserialize($share['data']); $list_data = array_merge($share, $data); unset($list_data['data']); //dump($share); if ($temp) { foreach ($list_data as $k => $v) { //替换 $v = h($v); $temp = str_replace('{' . $k . '}', $v, $temp); } $temp = str_replace('{WR}', SITE_URL, $temp); $temp = str_replace('{SITE_URL}', SITE_URL, $temp); return $temp; } else { return ''; } }
/** * _initialize * 初始化函数 * * 初始化数据模型,用户ID * @param string $aArgs 参数说明 * @access public * @return void */ public function _initialize() { $this->model = D('Share'); $this->Cmodel = D('ShareType'); $this->types = ts_cache('share_types'); if (empty($this->types)) { $this->types = type_cache(); } }
function getTypeAlias($typeId) { $types = ts_cache('share_types'); if (empty($types)) { $types = type_cache(); } $alias = $types[$typeId]['alias']; return $alias; }
function doEditTypes() { $title = $_POST['title']; $alias = $_POST['alias']; $sort = $_POST['sort']; foreach ($_POST['id'] as $v) { if (empty($v)) { continue; } $map['title'] = $title[$v]; $map['alias'] = $alias[$v]; $map['sort'] = $sort[$v]; $map['id'] = $v; $result = $this->Cmodel->save($map); } if ($result) { $this->types = type_cache(); $this->success('更新成功!'); } else { $this->error('更新失败!'); } }