public function render($data) { $tpl_section = $data['tpl']; $info = $data['info']; $tpl_section = $this->handle($tpl_section, '{$[title]}', op_t($info['title'])); $tpl_section = $this->handle($tpl_section, '{$[cTime]}', friendlyDate($info['create_time'])); $tpl_section = $this->handle($tpl_section, '{$[cTimeD]}', date('n j', $info['create_time'])); $tpl_section = $this->handle($tpl_section, '{$[url]}', U('Cat/Index/info', array('info_id' => $info['id']))); /*用户标签*/ $user = query_user(array('nickname', 'avatar32', 'avatar64', 'avatar128', 'avatar256', 'space_url'), $info['uid']); $tpl_section = $this->handle($tpl_section, '{$[user_avatar32]}', $user['avatar32']); $tpl_section = $this->handle($tpl_section, '{$[user_avatar64]}', $user['avatar64']); $tpl_section = $this->handle($tpl_section, '{$[user_avatar128]}', $user['avatar128']); $tpl_section = $this->handle($tpl_section, '{$[user_avatar256]}', $user['avatar256']); $tpl_section = $this->handle($tpl_section, '{$[user_nickname]}', $user['nickname']); $tpl_section = $this->handle($tpl_section, '{$[user_space_url]}', $user['space_url']); $tpl_section = $this->handle($tpl_section, '{$[user_uid]}', $user['uid']); /*用户标签end*/ $tpl_section = $this->handle($tpl_section, '{$[fav_btn]}', R('FavBtn/render', array(array('info' => $info)), 'Widget')); $entity = D('cat_entity')->find($info['entity_id']); if ($entity['can_over']) { $tpl_section = $this->handle($tpl_section, '{$[over_time]}', date('Y-m-d', $info['over_time'])); } else { $tpl_section = $this->handle($tpl_section, '{$[over_time]}', ''); } return $tpl_section; }
public function render($is_following = 0, $uid = 0) { $uid = op_t($uid); $this->assign('is_following', $is_following); $this->assign('uid', $uid); $this->display(T('Application://Common@Widget/ufollow')); }
public function addData($name, $value, $info_id, $entity_id) { $map['name'] = $name; $map['entity_id'] = $entity_id; $profile = M('cat_field')->where($map)->find(); $content_data['id'] = $profile; $content_data['field_id'] = $profile['id']; if (!$this->validateField($profile, $value)) { return false; } if (!is_array($value)) { //如果值不是数组 if ($profile['input_type'] == IT_DATE) { $content_data['value'] = strtotime($value); } else { $content_data['value'] = $value; } $content_data['info_id'] = $info_id; return $this->add($content_data); } else { $rs = 1; foreach ($value as $v) { //如果是数组 $content_data['value'] = op_t($v); $content_data['info_id'] = $info_id; $rs = $rs && $this->add($content_data); } return $rs; } }
public function getLastMessage($talk_id) { $last_message = D('TalkMessage')->where('talk_id=' . $talk_id)->order('create_time desc')->find(); $last_message['user'] = query_user(array('nickname', 'space_url', 'id'), $last_message['uid']); $last_message['content'] = op_t($last_message['content']); return $last_message; }
public function getLinkContent() { require_once './ThinkPHP/Library/Vendor/Collection/phpQuery.php'; $link = op_t(I('post.url')); $content = get_content_by_url($link); $charset = preg_match("/<meta.+?charset=[^\\w]?([-\\w]+)/i", $content, $temp) ? strtolower($temp[1]) : "utf-8"; \phpQuery::$defaultCharset = $charset; \phpQuery::newDocument($content); $title = pq("meta[name='title']")->attr('content'); if (empty($title)) { $title = pq("title")->html(); } $title = iconv($charset, "UTF-8", $title); $keywords = pq("meta[name='keywords'],meta[name='Keywords']")->attr('content'); $description = pq("meta[name='description'],meta[name='Description']")->attr('content'); $url = parse_url($link); $img = pq("img")->eq(0)->attr('src'); if (is_bool(strpos($img, 'http://'))) { $img = 'http://' . $url['host'] . $img; } $title = text($title); $description = text($description); $keywords = text($keywords); $return['title'] = $title; $return['img'] = $img; $return['description'] = empty($description) ? $title : $description; $return['keywords'] = empty($keywords) ? $title : $keywords; exit(json_encode($return)); }
public function search($uid = 0, $page = 1, $lastId = 0) { $keywords = op_t($_REQUEST['keywords']); if (!isset($keywords)) { $keywords = ''; } //载入第一页微博 if ($uid != 0) { $result = $this->weiboApi->listAllWeibo($page, null, array('uid' => $uid), 1, $lastId, $keywords); } else { $result = $this->weiboApi->listAllWeibo($page, 0, '', 1, $lastId, $keywords); } //显示页面 $this->assign('list', $result['list']); $this->assign('lastId', $result['lastId']); $this->assign('page', $page); $this->assign('tab', 'all'); $this->assign('loadMoreUrl', U('loadWeibo', array('uid' => $uid, 'keywords' => $keywords))); if (isset($keywords) && $keywords != '') { $map['content'] = array('like', "%{$keywords}%"); } $total_count = $this->weiboApi->listAllWeiboCount($map); $this->assign('key_words', $keywords); $this->assign('total_count', $total_count['total_count']); $this->assign('tox_money_name', getToxMoneyName()); $this->assign('tox_money', getMyToxMoney()); $this->setTitle('全站搜索微博'); $this->assign('filter_tab', '全站动态'); $this->assignSelf(); $this->display(); }
public function user() { $Channel = D('UserNav'); if (IS_POST) { $one = $_POST['nav'][1]; if (count($one) > 0) { M()->execute('TRUNCATE TABLE ' . C('DB_PREFIX') . 'user_nav'); for ($i = 0; $i < count(reset($one)); $i++) { $data[$i] = array('title' => op_t($one['title'][$i]), 'url' => op_t($one['url'][$i]), 'sort' => intval($one['sort'][$i]), 'target' => intval($one['target'][$i]), 'color' => op_t($one['color'][$i]), 'band_text' => op_t($one['band_text'][$i]), 'band_color' => op_t($one['band_color'][$i]), 'icon' => op_t(str_replace('icon-', '', $one['icon'][$i])), 'status' => 1); $pid[$i] = $Channel->add($data[$i]); } S('common_user_nav', null); $this->success(L('_CHANGE_')); } $this->error(L('_NAVIGATION_AT_LEAST_ONE_')); } else { /* 获取频道列表 */ $map = array('status' => array('gt', -1)); $list = $Channel->where($map)->order('sort asc,id asc')->select(); foreach ($list as $k => &$v) { $module = D('Module')->where(array('entry' => $v['url']))->find(); $v['module_name'] = $module['name']; unset($key, $val); } unset($k, $v); $this->assign('module', $this->getModules()); $this->assign('list', $list); $this->meta_title = L('_NAVIGATION_MANAGEMENT_'); $this->display(); } }
public function navigation() { if (IS_POST) { $one = $_POST['nav'][1]; if (count($one) > 0) { D()->execute('TRUNCATE TABLE ' . C('DB_PREFIX') . 'mob_channel'); for ($i = 0; $i < count(reset($one)); $i++) { $data[$i] = array('pid' => 0, 'title' => op_t($one['title'][$i]), 'url' => op_t($one['url'][$i]), 'sort' => intval($one['sort'][$i]), 'target' => intval($one['target'][$i]), 'color' => op_t($one['color'][$i]), 'band_text' => op_t($one['band_text'][$i]), 'band_color' => op_t($one['band_color'][$i]), 'icon' => op_t($one['icon'][$i]), 'status' => 1); $pid[$i] = M('MobChannel')->add($data[$i]); } $two = $_POST['nav'][2]; for ($j = 0; $j < count(reset($two)); $j++) { $data_two[$j] = array('pid' => $pid[$two['pid'][$j]], 'title' => op_t($two['title'][$j]), 'url' => op_t($two['url'][$j]), 'sort' => intval($two['sort'][$j]), 'target' => intval($two['target'][$j]), 'color' => op_t($two['color'][$j]), 'band_text' => op_t($two['band_text'][$j]), 'band_color' => op_t($two['band_color'][$j]), 'icon' => op_t($two['icon'][$j]), 'status' => 1); $res[$j] = M('MobChannel')->add($data_two[$j]); } S('common_nav', null); $this->success('修改成功'); } $this->error('导航至少存在一个。'); } else { /* 获取频道列表 */ $map = array('status' => array('gt', -1), 'pid' => 0); $list = M('MobChannel')->where($map)->order('sort asc,id asc')->select(); foreach ($list as $k => &$v) { $v['module_name'] = explode('/', $v['url']); $v['module_name'] = $v['module_name'][1]; } unset($k, $v); // dump($list);exit; $this->assign('module', $this->getMobModules()); $this->assign('list', $list); $this->meta_title = '导航管理'; $this->display(T('Application://Mob@Mob/navigation')); } }
function parse_weibo_mob_content($content) { $content = shorten_white_space($content); $content = op_t($content, false); $content = parse_url_link($content); $content = parseWeiboContent($content); return $content; }
public function parseComment($content) { $content = shorten_white_space($content); $content = op_t($content, false); $content = parse_url_link($content); $content = parse_expression($content); // $content = parseWeiboContent($content); return $content; }
function text_part($aContent) { $arr = array(); preg_match_all("/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg|\\.png]))[\\'|\"].*?[\\/]?>/", $aContent, $arr); //匹配所有的图片 $data['image'] = $arr[1]; $data['content'] = op_t($aContent); return $data; }
function parse_weibo_content($content) { $content = shorten_white_space($content); $content = op_t($content, false); $content = parse_url_link($content); $content = parse_expression($content); $content = parse_at_users($content); $content = parseWeiboContent($content); return $content; }
public function category($category_id = 0) { $map['category'] = $category_id; $map['status'] = 1; $questionModel = new QuestionModel(); $hot_list = $questionModel->getList($map, '*', 5, 'answer_num desc'); foreach ($hot_list as &$val) { $val['info'] = msubstr(op_t($val['description']), 0, 50); } unset($val); $this->assign('hot_list', $hot_list); $this->display(T('Application://Question@Widget/category')); }
public function register($username = '', $nickname = '', $password = '', $repassword = '', $email = '', $verify = '', $type = 'start') { $type = op_t($type); if (!C('USER_ALLOW_REGISTER')) { $this->error('注册已关闭'); } $verifyarr = explode(',', C('VERIFY_OPEN')); if (in_array('1', $verifyarr)) { $this->assign('isverify', 1); } else { $this->assign('isverify', 0); } if (IS_POST) { //注册用户 /* 检测验证码 TODO: */ if (in_array('1', $verifyarr)) { if (!$this->check_verify($verify)) { $this->error('验证码输入错误!'); } } if ($password != $repassword) { $this->error('两次密码输入不一致'); } /* 调用注册接口注册用户 */ $User = new UserApi(); $uid = $User->register($username, $nickname, $password, $email); if (0 < $uid) { //注册成功 sendMessage($uid, 0, '注册成功', '恭喜您!您已经注册成功,请尽快<a href="' . U('Ucenter/yzmail') . '">验证邮箱地址</a>,第一时间获取网站动态!', 0); $uid = $User->login($username, $password); //通过账号密码取到uid D('Member')->login($uid, false); //登陆 asyn_sendmail($email, 2); setuserscore($uid, C('REGSCORE')); $this->success('注册成功并登陆!', cookie('referurl')); } else { //注册失败,显示错误信息 $this->error($this->showRegError($uid)); } } else { //显示注册表单 if (is_login()) { redirect(cookie('referurl')); } if (cookie('referurl') == '') { cookie('referurl', $_SERVER['HTTP_REFERER']); } $this->display(); } }
public function index($type = 'forum', $page = 1) { $this->requireLogin(); $type = op_t($type); $totalCount = 0; $list = $this->_getList($type, $totalCount, $page); $this->assign('totalCount', $totalCount); $this->assign('list', $list); //设置Tab $this->defaultTabHash('collection'); $this->assign('type', $type); $this->setTitle(L('_MY_FAVORITES_')); $this->display($type); }
public function render($data) { $content = '<span class="bld">' . $data['field']['alias'] . '</span>:'; //检测是否过期隐藏 if ($data['overed'] && $data['field']['over_hidden']) { $content .= '<span class="cred" id="' . $data['data']['field']['name'] . '">过期隐藏</span>'; return $content; } $content .= '<span id="' . $data['data']['field']['name'] . '">'; switch ($data['field']['input_type']) { case IT_SINGLE_TEXT: //单行文本 //单行文本 case IT_MULTI_TEXT: //多行文本 $content .= op_h($data['data']['data'][0]); break; case IT_EDITOR: //编辑器 $content .= "<br/>" . op_h($data['data']['data'][0]); break; case IT_DATE: //日期 $content .= date('Y-m-d', $data['data']['data'][0]); //dump($data['data']['data'][0]);exit; break; //选择框 //选择框 case IT_SELECT: //下拉框 $content .= op_t($data['data']['data'][0]); break; case IT_RADIO: //单选框 $content .= op_t($data['data']['data'][0]); break; case IT_PIC: //单图片 if (intval($data['data']['data'][0]) == 0) { return ''; } $content .= '<a class="pic_field" target="_blank" href="' . get_cover($data['data']['data'][0], 'path') . '"><img title="点击查看大图" class="pic_size" src="' . getThumbImageById($data['data']['data'][0], 100, 100) . '"></a>'; break; case IT_CHECKBOX: $content .= $data['data']['data'][0] . ' '; break; } $content .= '</span>'; echo $content; }
function index($page = 1) { $this->requireLogin(); $uid = isset($_GET['uid']) ? op_t($_GET['uid']) : is_login(); $map['status'] = 1; $map['uid'] = $uid; $page = intval($page); $atlas_list = $this->atlasModel->where($map)->page($page, 10)->order('addtime desc, id desc')->select(); $totalCount = $this->atlasModel->where($map)->count(); $list_ids = getSubByKey($atlas_list, 'id'); $atlas_list = $this->getAtlasByIds($list_ids); $this->assign('atlas_list', $atlas_list); $this->assign('totalCount', $totalCount); $this->assign('current', 'user'); }
public function getLZLReplyList($to_f_reply_id, $order, $page = 1, $limit) { $list = S('post_replylzllist_' . $to_f_reply_id); if ($list == null) { $list = D('forum_lzl_reply')->where('is_del=0 and to_f_reply_id=' . $to_f_reply_id)->order($order)->select(); foreach ($list as $k => &$v) { $v['userInfo'] = query_user(array('avatar', 'username', 'uid', 'space_url', 'icons_html'), $v['uid']); $v['content'] = op_t($v['content']); } unset($v); S('post_replylzllist_' . $to_f_reply_id, $list, 60); } $list = getPage($list, $limit, $page); return $list; }
/** * @param $uid * @param $post_id * @param $content * @param $reply_id * @return string * @auth 陈一枭 */ private function sendReplyMessage($uid, $post_id, $content, $reply_id) { $limit = 10; $map['status'] = 1; $map['post_id'] = $post_id; $count = M('ForumPostReply')->where($map)->count(); $pageCount = ceil($count / $limit); //增加轻博客的评论数量 $user = query_user(array('nickname', 'space_url'), $uid); $post = M('ForumPost')->find($post_id); $title = $user['nickname'] . '回复了您的帖子。'; $content = '回复内容:' . mb_substr(op_t($content), 0, 20); M('Message')->sendMessage($post['uid'], $title, $content, 'Forum/Index/detail#' . $reply_id, array('id' => $post_id, 'page' => $pageCount), $uid, 2); return $pageCount; }
public function find($page = 1, $keywords = '') { $nickname = op_t($keywords); if ($nickname != '') { $map['nickname'] = array('like', '%' . $nickname . '%'); } $list = D('Member')->where($map)->findPage(18); foreach ($list['data'] as &$v) { $v['user'] = query_user(array('avatar128', 'space_url', 'username', 'fans', 'following', 'signature', 'nickname'), $v['uid']); } unset($v); $this->assign('lists', $list); $this->assign('nickname', $nickname); $this->display(); }
public function sendMessage($content, $to_uids, $talk_id) { foreach ($to_uids as $uid) { /** * @param $to_uids 接受消息的用户ID * @param string $content 内容 * @param string $title 标题,默认为 您有新的消息 * @param $url 链接地址,不提供则默认进入消息中心 * @param $int $from_uid 发起消息的用户,根据用户自动确定左侧图标,如果为用户,则左侧显示头像 * @param int $type 消息类型,0系统,1用户,2应用 */ if ($uid != is_login()) { D('Message')->sendMessage($uid, '对话内容:' . op_t($content), '您有新的聊天消息', U('UserCenter/Message/talk', array('talk_id' => $talk_id)), is_login(), 1); } } }
public function handleAtWho($content, $url = '', $app_name = '') { $uids = get_at_uids($content); $uids = array_unique($uids); $sender = query_user(array('username')); foreach ($uids as $uid) { //$user = D('User/UcenterMember')->find($uid); $title = $sender['username'] . '@了您'; $message = '评论内容:' . mb_substr(op_t($content), 0, 50, 'utf-8'); if ($url == '') { //如果未设置来源的url,则自动跳转到来源页面 $url = $_SERVER['HTTP_REFERER']; } D('Common/Message')->sendMessage($uid, $message, $title, $url, get_uid(), 0, $app_name); } }
/** * @param $uid * @param $post_id * @param $content * @param $reply_id * @return string * @auth Rocks */ private function sendReplyMessage($uid, $post_id, $content, $reply_id) { $limit = 10; $map['status'] = 1; $map['post_id'] = $post_id; $count = D('ForumPostReply')->where($map)->count(); $pageCount = ceil($count / $limit); //增加微博的评论数量 $user = query_user(array('nickname', 'space_url'), $uid); $post = D('ForumPost')->find($post_id); $title = $user['nickname'] . '回复了您的帖子。'; $content = '回复内容:' . mb_substr(op_t($content), 0, 20); $url = U('/Team/Forum/detail', array('id' => $post_id, 'page' => $pageCount)) . '#' . $reply_id; $from_uid = $uid; D('Message')->sendMessage($post['uid'], $content, $title, $url, $from_uid, 2, null, 'reply', $post_id, $reply_id); return $url; }
public function doSendLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, $content, $p = 1) { //确认用户已经登录 $this->requireLogin(); //写入数据库 $model = D('ForumLzlReply'); $before = getMyScore(); $result = $model->addLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, op_t($content), $p); $after = getMyScore(); if (!$result) { $this->error('发布失败:' . $model->getError()); } //显示成功页面 $totalCount = D('forum_lzl_reply')->where('is_del=0 and to_f_reply_id=' . $to_f_reply_id)->count(); $limit = 5; $pageCount = ceil($totalCount / $limit); exit(json_encode(array('status' => 1, 'info' => '回复成功。' . getScoreTip($before, $after), 'url' => $pageCount))); }
/** * 频道列表 * @author 麦当苗儿 <*****@*****.**> */ public function index() { $Channel = D('Channel'); if (IS_POST) { $one = $_POST['nav'][1]; if (count($one) > 0) { M()->execute('TRUNCATE TABLE ' . C('DB_PREFIX') . 'channel'); for ($i = 0; $i < count(reset($one)); $i++) { $data[$i] = array('pid' => 0, 'title' => op_t($one['title'][$i]), 'url' => op_t($one['url'][$i]), 'sort' => intval($one['sort'][$i]), 'target' => intval($one['target'][$i]), 'color' => op_t($one['color'][$i]), 'band_text' => op_t($one['band_text'][$i]), 'band_color' => op_t($one['band_color'][$i]), 'icon' => op_t(str_replace('icon-', '', $one['icon'][$i])), 'status' => 1); $pid[$i] = $Channel->add($data[$i]); } $two = $_POST['nav'][2]; for ($j = 0; $j < count(reset($two)); $j++) { $data_two[$j] = array('pid' => $pid[$two['pid'][$j]], 'title' => op_t($two['title'][$j]), 'url' => op_t($two['url'][$j]), 'sort' => intval($two['sort'][$j]), 'target' => intval($two['target'][$j]), 'color' => op_t($two['color'][$j]), 'band_text' => op_t($two['band_text'][$j]), 'band_color' => op_t($two['band_color'][$j]), 'icon' => op_t(str_replace('icon-', '', $two['icon'][$j])), 'status' => 1); $res[$j] = $Channel->add($data_two[$j]); } S('common_nav', null); $this->success('修改成功'); } $this->error('导航至少存在一个。'); } else { /* 获取频道列表 */ $map = array('status' => array('gt', -1), 'pid' => 0); $list = $Channel->where($map)->order('sort asc,id asc')->select(); foreach ($list as $k => &$v) { $module = D('Module')->where(array('entry' => $v['url']))->find(); $v['module_name'] = $module['name']; $child = $Channel->where(array('status' => array('gt', -1), 'pid' => $v['id']))->order('sort asc,id asc')->select(); foreach ($child as $key => &$val) { $module = D('Module')->where(array('entry' => $val['url']))->find(); $val['module_name'] = $module['name']; } unset($key, $val); $child && ($v['child'] = $child); } unset($k, $v); $this->assign('module', $this->getModules()); $this->assign('list', $list); $this->meta_title = '导航管理'; $this->display(); } }
private function _getList($map, $limit, $order) { $questionModel = new QuestionModel(); $questionAnswerModel = new QuestionAnswerModel(); $list = $questionModel->getList($map, '*', $limit, $order); foreach ($list as &$val) { $val['info'] = msubstr(op_t($val['description']), 0, 200); $val['img'] = get_pic($val['description']); $val['user'] = query_user(array('uid', 'space_url', 'nickname', 'avatar64'), $val['uid']); if ($val['best_answer']) { $val['best_answer_info'] = $questionAnswerModel->getData(array('id' => $val['best_answer'], 'status' => 1)); } else { $val['best_answer_info'] = $questionAnswerModel->getData(array('question_id' => $val['id'], 'status' => 1), 'support desc'); } if ($val['best_answer_info']) { $val['best_answer_info']['content'] = msubstr(op_t($val['best_answer_info']['content']), 0, 200); } } return $list; }
private function _getList($map, $page = 1, $r = 20) { $questionModel = new QuestionModel(); $questionAnswerModel = new QuestionAnswerModel(); list($list, $totalCount) = $questionModel->getListPageByMap($map, $page, 'create_time desc', $r, '*'); foreach ($list as &$val) { $val['info'] = msubstr(op_t($val['description']), 0, 200); $val['img'] = get_pic($val['description']); $val['user'] = query_user(array('uid', 'space_url', 'nickname'), $val['uid']); if ($val['best_answer']) { $val['best_answer_info'] = $questionAnswerModel->getData(array('id' => $val['best_answer'], 'status' => 1)); } else { $val['best_answer_info'] = $questionAnswerModel->getData(array('question_id' => $val['id'], 'status' => 1), 'support desc'); } if ($val['best_answer_info']) { $val['best_answer_info']['content'] = msubstr(op_t($val['best_answer_info']['content']), 0, 200); } } return array($list, $totalCount); }
public function handleAtWho($content, $url = '', $app_name = '', $escap_first = false) { $uids = get_at_uids($content); $uids = array_unique($uids); $sender = query_user(array('nickname')); $first = true; foreach ($uids as $uid) { if ($escap_first && $first) { $first = false; continue; } //$user = UCenterMember()->find($uid); $title = $sender['nickname'] . '@了您'; $message = '评论内容:' . mb_substr(op_t($content), 0, 50, 'utf-8'); if ($url == '') { //如果未设置来源的url,则自动跳转到来源页面 $url = $_SERVER['HTTP_REFERER']; } D('Common/Message')->sendMessage($uid, $message, $title, $url, get_uid(), 0, $app_name); } }
/** * 菜单列表 * @author patrick <*****@*****.**> */ public function index() { $cm = D('Mpbase/CustomMenu'); if (IS_POST) { $one = $_POST['cm'][1]; if (count($one) > 0) { $map['token'] = get_token(); $cm->where($map)->delete(); for ($i = 0; $i < count(reset($one)); $i++) { $data[$i] = array('pid' => 0, 'sort' => intval($one['sort'][$i]), 'title' => op_t($one['title'][$i]), 'keyword' => op_t($one['keyword'][$i]), 'url' => op_t($one['url'][$i]), 'token' => op_t($one['token'][$i]), 'type' => op_t($one['type'][$i]), 'status' => 1); $pid[$i] = $cm->add($data[$i]); } $two = $_POST['cm'][2]; for ($j = 0; $j < count(reset($two)); $j++) { $data_two[$j] = array('pid' => $pid[$two['pid'][$j]], 'sort' => intval($two['sort'][$j]), 'title' => op_t($two['title'][$j]), 'keyword' => op_t($two['keyword'][$j]), 'url' => op_t($two['url'][$j]), 'token' => op_t($two['token'][$j]), 'type' => op_t($two['type'][$j]), 'status' => 1); $res[$j] = $cm->add($data_two[$j]); } $this->success('修改成功'); } $this->error('菜单至少存在一个。'); } else { /* 获取菜单列表 */ $map = array('status' => array('gt', -1), 'token' => get_token(), 'pid' => 0); $list = $cm->where($map)->order('sort asc,id asc')->select(); foreach ($list as $k => &$v) { $child = $cm->where(array('status' => array('gt', -1), 'pid' => $v['id']))->order('sort asc,id asc')->select(); foreach ($child as $key => &$val) { } unset($key, $val); $child && ($v['child'] = $child); } unset($k, $v); $this->assign('type', $cm->getCmType()); $this->assign('list', $list); $this->meta_title = '自定义菜单管理'; $this->display(); } }
public function createPost($data) { //新增帖子 $at_source = $data['content']; $data = $this->create($data); //对帖子内容进行安全过滤 if (!$data) { return false; } $content = $this->filterPostContent($data['content']); $data['content'] = $content; $data['title'] = op_t($data['title']); $result = $this->add($data); action_log('add_post', 'ForumPost', $result, is_login()); if (!$result) { return false; } //增加板块的帖子数量 D('Forum')->where(array('id' => $data['forum_id']))->setInc('post_count'); $this->handlerAt($at_source, $result); //返回帖子编号 return $result; }