private function filterPostContent($content) { $content = op_h($content); $content = $this->limitPictureCount($content); $content = op_h($content); return $content; }
function filter_post_content($content) { $content = op_h($content); $content = limit_picture_count($content); $content = op_h($content); return $content; }
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; }
public function render($data) { $rs = $data['str']; $field = $data['field']; $value = ''; switch ($field['field']['input_type']) { case IT_SINGLE_TEXT: //单行文本 //单行文本 case IT_MULTI_TEXT: $value = op_t($field['data'][0]); break; case IT_EDITOR: $value = op_h($field['data'][0]); break; //选择框 //选择框 case IT_SELECT: $value = op_t($field['data'][0]); break; case IT_PIC: $value = getThumbImageById($field['data'][0]); break; case IT_RADIO: $value = op_t($field['data'][0]); break; case IT_CHECKBOX: $value = $field['data'][0]; //$value = t($field['values']['data'][$field['data'][0]]); break; } if ($data['only_value']) { return $value; } $rs = str_replace('{$' . $field['field']['name'] . '}', $value, $rs); return $rs; }
public function doSendIssue() { $data['cover_id'] = $aCoverId = I('post.one_attach_id', 0, 'op_t'); $data['title'] = $aTitle = I('post.title', '', 'op_t'); $data['id'] = $aId = I('post.id', 0, 'op_t'); $data['IssueId'] = $IssueId = I('post.issueId', 0, 'op_t'); //专辑的ID $data['issue_id'] = $aIssueId = I('post.issue_id', 0, 'op_t'); //专辑分类ID $data['url'] = $aUrl = I('post.url', '', 'op_t'); $data['content'] = $aContent = I('post.content', '', 'op_t'); $issue_id = intval($aIssueId); if (!$aCoverId) { $this->error('请上传封面。'); } if (trim(op_t($aTitle)) == '') { $this->error('请输入标题。'); } if (trim(op_h($aContent)) == '') { $this->error('请输入内容。'); } if ($issue_id == 0) { $this->error('请选择分类。'); } if (trim(op_h($aUrl)) == '') { $this->error('请输入网址。'); } $content = D('Issue/IssueContent')->create($data); $content['content'] = op_h($content['content']); $content['title'] = op_t($content['title']); $content['url'] = op_t($content['url']); //新增链接框 $content['issue_id'] = $issue_id; if ($IssueId) { $content_temp = D('IssueContent')->find($IssueId); if (!check_auth('editIssueContent')) { //不是管理员则进行检测 if ($content_temp['uid'] != is_login()) { $this->error('不可操作他人的内容。'); } } $content['uid'] = $content_temp['uid']; //权限矫正,防止被改为管理员 $content['id'] = $IssueId; $rs = D('IssueContent')->save($content); // dump(D('IssueContent')->getLastSql());exit; if ($rs) { $this->success('编辑成功。', U('issueContentDetail', array('id' => $content['id']))); } else { $this->success('编辑失败。', ''); } } else { if (modC('NEED_VERIFY', 0) && !is_administrator()) { $content['status'] = 0; $tip = '但需管理员审核通过后才会显示在列表中,请耐心等待。'; $user = query_user(array('nickname', 'uid'), is_login()); $admin_uids = explode(',', C('USER_ADMINISTRATOR')); foreach ($admin_uids as $admin_uid) { D('Common/Message')->sendMessage($admin_uid, $title = '专辑投稿提醒', "{$user['nickname']}向专辑投了一份稿件,请到后台审核。", 'Admin/Issue/verify', array('id' => $IssueId), is_login(), 2); } } // dump($content);exit; $rs = D('IssueContent')->add($content); if ($rs) { $return['status'] = 1; } else { $return['status'] = 0; $return['info'] = '发布失败'; } } $this->ajaxReturn($return); }
public function doAddInfo() { unset($_POST['__hash__']); $aEntityId = I('post.entity_id', 0, 'intval'); $aInfoId = I('post.info_id', 0, 'intval'); $aCat1 = I('post.cat1', 0, 'intval'); $aCat2 = I('post.cat2', 0, 'intval'); $aCat3 = I('post.cat3', 0, 'intval'); $aTitle = I('post.title', '', 'op_t'); $aShopId = I('post.shop_id', 0, 'intval'); $aPrice = I('post.price', 0, 'floatval'); if ($aPrice <= 0) { $this->error('价格必须大于0'); } $aCoverId = I('post.cover_id', 0, 'intval'); if ($aCoverId == 0) { $this->error('商品主图必须上传。'); } $aGallary = I('post.gallary', array(), 'intval'); if (count($aGallary) > 9) { $this->error('相册图片不能超过9张!'); } $aTransFee = I('post.trans_fee', 0, 'intval'); $aDes = I('post.des', '', 'op_h'); if ($aDes == '') { $this->error('商品描述必填。'); } $entity = $this->requireCanPost($aEntityId); $info = D('Goods')->find($aInfoId); $info['title'] = $aTitle; $info['cat1'] = $aCat1; $info['cat2'] = $aCat2; $info['cat3'] = $aCat3; $info['price'] = $aPrice; $info['cover_id'] = $aCoverId; $info['trans_fee'] = $aTransFee == 1 ? 1 : 0; $info['gallary'] = encodeGallary($aGallary); //implode(',', $aGallary); $info['des'] = $aDes; if ($info['title'] == '') { $this->error('必须输入标题'); } if (mb_strlen($info['title'], 'utf-8') > 40) { $this->error('标题过长。'); } if ($aInfoId != 0) { $this->checkAuth('Store/Center/postEdit', $info['uid'], '你没有编辑该商品的权限!'); $this->checkActionLimit('goods_edit', 'store', $aInfoId, is_login()); $info['update_time'] = time(); //保存逻辑 $info['id'] = $aInfoId; D('Goods')->save($info); $rs_info = $info['id']; } else { $this->checkAuth('Store/Center/postAdd', -1, '你没有发布商品的权限!'); $this->checkActionLimit('goods_add', 'store', null, is_login()); $info['create_time'] = time(); //新增逻辑 $info['entity_id'] = $aEntityId; $info['uid'] = is_login(); if ($entity['need_active'] && !is_administrator()) { $info['status'] = 2; } else { $info['status'] = 1; } //如果是商品就新增字段 if ($entity['name'] == 'good') { $info['shop_id'] = $aShopId; } $rs_info = D('Goods')->add($info); } $rs_data = 1; if ($rs_info != 0) { if ($aInfoId != 0) { action_log('goods_edit', 'store', $aInfoId, is_login()); $map_data['info_id'] = $aInfoId; D('Data')->where($map_data)->delete(); } else { action_log('goods_add', 'store', $rs_info, is_login()); } $dataModel = D('Data'); foreach ($_POST as $key => $v) { $band = 'entity_id,over_time,ignore,info_id,title,__hash__,shop_id,cat1,cat2,cat3,price,cat,cover_id,gallary,trans_fee,des,file'; if (!in_array($key, explode(',', $band))) { if (is_array($v)) { $rs_data = $rs_data && $dataModel->addData($key, implode(',', $v), $rs_info, $aEntityId); } else { $v = op_h($v); $rs_data = $rs_data && $dataModel->addData($key, $v, $rs_info, $aEntityId); } } if ($rs_data == 0) { $this->error($dataModel->getError()); } } if ($rs_info && $rs_data) { $this->assign('jumpUrl', U('store/Index/info', array('info_id' => $rs_info))); if ($entity['need_active']) { // $this->success('发布成功。请耐心等待管理员审核。通过审核后该信息将出现在前台页面中。'); } else { if ($entity['show_nav']) { $postUrl = U('store/index/info', array('info_id' => $rs_info), null, true); } } } } else { $this->error('发布失败。'); } if ($entity['name'] == 'shop') { if ($rs_info == 0) { $this->error('新增店铺失败。'); } elseif ($rs_data == 0) { if (I('post.info_id', 0, 'intval')) { $this->success('修改店铺信息失败。'); } else { $this->success('店铺创建成功,但相关信息添加失败,请联系管理员。'); } } else { if (I('post.info_id', 0, 'intval')) { $this->success('修改店铺信息成功。'); } else { $this->success('创建店铺成功。请耐心等待管理员审核。通过审核后即可上传商品。', U('store/center/post', array('name' => 'shop'))); } } return; } if ($entity['name'] == 'good') { if ($rs_info && $rs_data) { $entity = D('store_entity')->find($info['entity_id']); if ($entity['need_active']) { $this->success('发布成功。请耐心等待管理员审核。通过审核后该信息将出现在前台页面中。'); } else { if ($entity['show_nav']) { if (D('Common/Module')->isInstalled('Weibo')) { //安装了微博模块 $weiboModel = D('Weibo/Weibo'); $weiboModel->addWeibo("我上架了一个新的 " . $entity['alias'] . " 【" . $info['title'] . "】:" . $postUrl); } } $this->success('发布商品成功。即将跳转到商品页面。点击<a href="' . U('store/center/post', array('name' => 'good')) . '">继续发布</a>。', U('store/Index/info', array('info_id' => $rs_info)), 5); } } else { $this->error('商品发布失败,请联系管理员。。'); } } }
/** * 邮件发送历史 * @param string $title * autor:xjw129xjt */ public function history() { $title = I('title'); $map = array('status' => 1); if ($title != '') { $map['title'] = array('like', '%' . $title . '%'); } $mailList = D('MailHistory')->where($map)->order('create_time desc')->select(); foreach ($mailList as $k => &$v) { $v['title'] = getShortSp(op_h($v['title'], 'text'), 20); $v['body'] = getShortSp(op_h($v['body'], 'text'), 50); } $this->assign('mailList', $mailList); $this->display(T('Addons://Mail@Mail/history')); }
public function addComment() { $config = get_addon_config('LocalComment'); $can_guest_comment = $config['can_guest_comment']; if (!$can_guest_comment) { //不允许游客评论 if (!is_login()) { $this->error('请登录后评论。'); } } //获取参数 $app = strval($_REQUEST['app']); $mod = strval($_REQUEST['con']); $row_id = intval($_REQUEST['row_id']); $content = strval($_REQUEST['content']); $uid = intval($_REQUEST['uid']); $pid = intval($_REQUEST['pid']); if (M($mod)->where(array('id' => $row_id))->getField('status') != 1) { $this->error('该文章尚未审核通过!'); } $data = array('app' => $app, 'con' => $mod, 'row_id' => $row_id, 'content' => $content, 'uid' => is_login(), 'pid' => $pid); $commentModel = D('Addons://LocalComment/LocalComment'); $data = $commentModel->create($data); if (!$data) { $this->error('评论失败:' . $commentModel->getError()); } else { D($app . '/' . $mod)->where(array('id' => $row_id))->setInc('reply_count'); $rowinfo = D($app . '/' . $mod)->where(array('id' => $row_id))->find(); $data['content'] = op_h($data['content'], 'font'); $commentModel->add($data); if (!is_login()) { if ($uid) { $title = '游客' . '评论了您'; $message = '评论内容:' . $content; $url = $_SERVER['HTTP_REFERER']; if (strtolower($mod) == 'article') { $rowurl = U('Home/Index/artc', array('id' => $row_id)); } if (strtolower($mod) == 'music') { $rowurl = U('Home/Index/musicc', array('id' => $row_id)); } if (strtolower($mod) == 'group') { $rowurl = U('Home/Index/groupc', array('id' => $row_id)); } sendMessage($rowinfo['uid'], '0', $title, $message . ',链接地址:<a href="' . $rowurl . '">' . $rowinfo['title'] . '</a>', 0); } //返回结果 $this->success('评论成功', 'refresh'); } else { //给评论对象发送消息 if ($uid) { $user = D('Member')->find(getnowUid()); $title = $user['nickname'] . '评论了您'; $message = '评论内容:' . $content; $url = $_SERVER['HTTP_REFERER']; if ($rowinfo['uid'] != getnowUid()) { if (strtolower($mod) == 'article') { $rowurl = U('Home/Index/artc', array('id' => $row_id)); } if (strtolower($mod) == 'music') { $rowurl = U('Home/Index/musicc', array('id' => $row_id)); } if (strtolower($mod) == 'group') { $rowurl = U('Home/Index/groupc', array('id' => $row_id)); } sendMessage($rowinfo['uid'], getnowUid(), $title, $message . ',链接地址:<a href="' . $rowurl . '">' . $rowinfo['title'] . '</a>', 0); } } } //通知被@到的人 $uids = get_at_uids($content); $uids = array_unique($uids); $uids = array_subtract($uids, array($uid)); foreach ($uids as $uid) { $user = D('Member')->find(getnowUid()); $title = $user['nickname'] . '@了您'; $message = '评论内容:' . $content; $url = $_SERVER['HTTP_REFERER']; sendMessage($uid, getnowUid(), $title, $message . ',链接地址:<a href="' . U('Index/artc', array('id' => $row_id)) . '">' . $rowinfo['title'] . '</a>', 0); } //返回结果 $this->success('评论成功'); } }
public function keyHtml($name, $title) { return $this->key($name, op_h($title), 'html'); }
/** * 发布活动 * @param int $id * @param int $cover_id * @param string $title * @param string $explain * @param string $sTime * @param string $eTime * @param string $address * @param int $limitCount * @param string $deadline * autor:xjw129xjt */ public function doPost($id = 0, $cover_id = 0, $title = '', $explain = '', $sTime = '', $eTime = '', $address = '', $limitCount = 0, $deadline = '', $type_id = 0, $sponsor) { if (!is_login()) { $this->error('请登陆后再投稿。'); } if (!$cover_id) { $this->error('请上传封面。'); } if (trim(op_t($title)) == '') { $this->error('请输入标题。'); } if (trim(op_t($sponsor)) == '') { $this->error('请输入主办方。'); } if ($type_id == 0) { $this->error('请选择分类。'); } if (trim(op_h($explain)) == '') { $this->error('请输入内容。'); } if (trim(op_h($address)) == '') { $this->error('请输入地点。'); } if ($sTime < $deadline) { $this->error('报名截止不能大于活动开始时间'); } if ($deadline == '') { $this->error('请输入截止日期'); } if ($sTime > $eTime) { $this->error('活动开始时间不能大于活动结束时间'); } $content = D('Event')->create(); $content['explain'] = op_h($content['explain']); $content['title'] = op_t($content['title']); $content['sTime'] = strtotime($content['sTime']); $content['eTime'] = strtotime($content['eTime']); $content['deadline'] = strtotime($content['deadline']); $content['type_id'] = intval($type_id); $this->check_action_limit('edit_event', 'event', 0, is_login(), true); if ($id) { $content_temp = D('Event')->find($id); if (!check_auth('Event/Index/edit', $content_temp['uid'])) { $this->error('您无该活动编辑权限。'); } $content['uid'] = $content_temp['uid']; //权限矫正,防止被改为管理员 $rs = D('Event')->save($content); if (D('Common/Module')->isInstalled('Weibo')) { //安装了微博模块 $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Event/Index/detail', array('id' => $id)); $weiboModel = D('Weibo/Weibo'); // $weiboModel->addWeibo("我修改了活动【" . $title . "】:" . $postUrl); } if ($rs) { $this->success('编辑成功。', U('detail', array('id' => $content['id']))); } else { $this->success('编辑失败。', ''); } } else { if (!check_auth('Event/Index/edit')) { $this->error('您无该活动编辑权限。'); } if (modC('NEED_VERIFY', 0) && !is_administrator()) { $content['status'] = 0; $tip = '但需管理员审核通过后才会显示在列表中,请耐心等待。'; $user = query_user(array('username', 'nickname'), is_login()); D('Common/Message')->sendMessage(C('USER_ADMINISTRATOR'), "{$user['nickname']}发布了一个活动,请到后台审核。", $title = '活动发布提醒', U('Admin/Event/verify'), is_login(), 2); } $rs = D('Event')->add($content); if (D('Common/Module')->isInstalled('Weibo')) { //安装了微博模块 //同步到微博 $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Event/Index/detail', array('id' => $rs)); $weiboModel = D('Weibo/Weibo'); // $weiboModel->addWeibo("我发布了一个新的活动【" . $title . "】:" . $postUrl); } if ($rs) { $this->success('发布成功。' . $tip, U('index')); } else { $this->success('发布失败。', ''); } } }
public function getIssueDetail() { $aId = I('id', 0, 'intval'); $map['status'] = 1; $width = I('width', 160, 'intval'); $height = I('height', 210, 'intval'); $aId && ($map['id'] = $aId); $IssueDetail = D('Issue/IssueContent')->where($map)->select(); foreach ($IssueDetail as &$v) { $v['user'] = query_user(array('uid', 'username', 'nickname', 'avatar128', 'signature'), $v['uid']); $v['content'] = op_h($v['content']); $v['cover_url'] = getThumbImageByCoverId($v['cover_id'], $width, $height); $v['issue'] = D('Issue/Issue')->where(array('id' => $v['issue_id']))->select(); foreach ($v['issue'] as &$c) { $c['create_time'] = friendlyDate($c['create_time']); $c['update_time'] = friendlyDate($c['update_time']); } $v['support_count'] = D('support')->where(array('appname' => 'Issue', 'table' => 'issue_content', 'row' => $aId))->count(); if (empty($v['support_count'])) { $v['is_supported'] = '0'; } else { $v['is_supported'] = '1'; } $v['create_time'] = friendlyDate($v['create_time']); $v['update_time'] = friendlyDate($v['update_time']); if (is_login() == $v['uid']) { $v['is_author'] = '1'; } else { $v['is_author'] = '0'; } } unset($v); $list = array('list' => $IssueDetail); $this->apiSuccess('返回成功', $list); }
function getpcomment($id) { $map['id'] = $id; $pid = M('LocalComment')->where($map)->getField('pid'); $map1['id'] = $pid; $content = M('LocalComment')->where($map1)->getField('content'); return op_h($content); }
/** * 发布活动 * @param int $id * @param int $cover_id * @param string $title * @param string $explain * @param string $sTime * @param string $eTime * @param string $address * @param int $limitCount * @param string $deadline * autor:xjw129xjt */ public function doPost($id = 0, $cover_id = 0, $title = '', $explain = '', $sTime = '', $eTime = '', $address = '', $limitCount = 0, $deadline = '', $type_id = 0) { if (!is_login()) { $this->error('请登陆后再投稿。'); } if (!$cover_id) { $this->error('请上传封面。'); } if (trim(op_t($title)) == '') { $this->error('请输入标题。'); } if ($type_id == 0) { $this->error('请选择分类。'); } if (trim(op_h($explain)) == '') { $this->error('请输入内容。'); } if (trim(op_h($address)) == '') { $this->error('请输入地点。'); } if ($eTime < $deadline) { $this->error('报名截止不能大于活动结束时间'); } if ($deadline == '') { $this->error('请输入截止日期'); } if ($sTime > $eTime) { $this->error('活动开始时间不能大于活动结束时间'); } $content = $this->eventModel->create(); $content['explain'] = filter_content($content['explain']); $content['title'] = op_t($content['title']); $content['sTime'] = strtotime($content['sTime']); $content['eTime'] = strtotime($content['eTime']); $content['deadline'] = strtotime($content['deadline']); $content['type_id'] = intval($type_id); if ($id) { $content_temp = $this->eventModel->find($id); $this->checkAuth('Event/Index/edit', $content_temp['uid'], '您无该活动编辑权限。'); $this->checkActionLimit('add_event', 'event', $id, is_login(), true); $content['uid'] = $content_temp['uid']; //权限矫正,防止被改为管理员 $rs = $this->eventModel->save($content); if (M('Common/Module')->isInstalled('Weibo')) { //安装了轻博客模块 $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('detail', array('id' => $id)); M('Weibo')->addWeibo(is_login(), "我修改了活动【" . $title . "】:" . $postUrl); } if ($rs) { action_log('add_event', 'event', $id, is_login()); $this->success('编辑成功。', U('detail', array('id' => $content['id']))); } else { $this->success('编辑失败。', ''); } } else { $this->checkAuth('Event/Index/add', -1, '您无活动发布权限。'); $this->checkActionLimit('add_event', 'event', 0, is_login(), true); if (modC('NEED_VERIFY', 0) && !is_administrator()) { $content['status'] = 0; $tip = '但需管理员审核通过后才会显示在列表中,请耐心等待。'; $user = query_user(array('username', 'nickname'), is_login()); M('Common/Message')->sendMessage(C('USER_ADMINISTRATOR'), $title = '活动发布提醒', "{$user['nickname']}发布了一个活动,请到后台审核。", 'Admin/Event/verify', array(), is_login(), 2); } $aIsAttend = I('post.isAttend', 0, 'intval'); if ($aIsAttend) { $content['attentionCount'] = 1; $content['signCount'] = 1; } $rs = $this->eventModel->add($content); if ($aIsAttend) { $data['uid'] = is_login(); $data['event_id'] = $rs; $data['name'] = '活动发布者'; $data['create_time'] = time(); $data['status'] = 1; $this->eventAttendModel->add($data); } if (M('Common/Module')->isInstalled('Weibo')) { //安装了轻博客模块 //同步到轻博客 $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Event/Index/detail', array('id' => $rs)); M('Weibo')->addWeibo(is_login(), "我发布了一个新的活动【" . $title . "】:" . $postUrl); } if ($rs) { action_log('add_event', 'event', $rs, is_login()); $this->success('发布成功。' . $tip, U('index')); } else { $this->success('发布失败。', ''); } } }
public function addGroup() { if (!is_login()) { $this->apiError('请登陆后再发起活动。'); } //基本信息 $aTitle = I('title', '', 'op_t'); $aDetail = I('detail', '', 'op_h'); $aTypeId = I('type_id', 0, 'intval'); /* $aBackground = I('background', 0, 'intval');*/ $aType = I('type', 0, 'intval'); $aLogo = I('logo', 0, 'intval'); $aId = I('id', 0, 'intval'); /* if (!$aBackground) { $this->apiError('请上传封面。'); }*/ if (trim(op_t($aTitle)) == '') { $this->apiError('请输入标题。'); } if ($aTypeId == 0) { $this->apiError('请选择分类。'); } if (trim(op_h($aDetail)) == '') { $this->apiError('请填写群组介绍。'); } /* if (!$aLogo) { $this->apiError('请上传背景'); }*/ $data = D('Group/Group')->create(); $data['detail'] = $aDetail; $data['title'] = $aTitle; $data['logo'] = $aLogo; /* $data['background'] = $aBackground;*/ $data['type'] = $aType; $data['type_id'] = $aTypeId; $data['create_time'] = time(); $data['uid'] = is_login(); //根据id查看是否已有活动 if ($aId) { $Group = D('Group/Group')->find($aId); if (!is_administrator(is_login())) { //不是管理员则进行检测 if ($Group['uid'] != is_login()) { $this->apiError('无权编辑'); } } //编辑基本信息 $result = D('Group/Group')->where(array('id' => $aId))->save($data); $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Event/Index/group', array('id' => $aId)); $weiboApi = new WeiboApi(); $weiboApi->resetLastSendTime(); $weiboApi->sendWeibo("我修改了群组【" . $aTitle . "】:" . $postUrl); if ($result) { $this->apiSuccess('编辑成功。', U('detail', array('id' => $data['id']))); } else { $this->apiError('编辑失败。'); } } else { if (modC('NEED_VERIFY', 1, 'group') && !is_administrator()) { $data['status'] = 0; $user = query_user(array('username', 'nickname'), is_login()); D('Common/Message')->sendMessage(C('USER_ADMINISTRATOR'), "{$user['nickname']}发布了一个活动,请到后台审核。", $title = '活动发布提醒', U('Admin/Group/verify'), is_login(), 2); } $Group = D('Group/Group')->add($data); //同步到微博 $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Group/Index/group', array('id' => $Group)); $weiboModel = D('Weibo/Weibo'); $weiboModel->addWeibo("我发布了一个新的活动【" . $aTitle . "】:" . $postUrl); if ($Group) { $this->apiSuccess('发布成功。但需管理员审核通过后才会显示在列表中,请耐心等待。'); } else { $this->apiError('发布失败。'); } } }
public function artedit() { if (IS_POST) { $input = new \OT\Input(); $input->noGPC(); $uid = $_SESSION['cs_home']['user_auth']['uid']; if (!$uid > 0) { $this->error('请先登录'); } if (false === ($data = D('Article')->create())) { $this->error(0, D('Article')->getError()); } $data['description'] = op_h(I('description')); if ($data['cid'] == null) { $this->error('分类为空'); } if (mb_strlen(op_h($data['description']), 'utf-8') < 30) { $this->error('文章内容必须大于30字'); } if (mb_strlen($data['title'], 'utf-8') > 80) { $this->error('文章标题必须小于80字'); } //$data['tag']=op_t($data['tag']); foreach ($data['tag'] as $key => $vo) { $data['tag'][$key] = mb_substr($vo, 0, 15, 'utf-8'); } D('Tags')->InsertTags($data['tag'], 1, $data['id']); $data['tag'] = implode(',', $data['tag']); //$data['description']=$data['description']; $data['title'] = op_t($data['title']); $data['uid'] = $uid; $status = $data['status']; $ystatus = D('Article')->where(array('id' => $data['id']))->getField('status'); //保存当前数据对象 $list = D('Article')->save($data); if ($list !== false) { if ($status == 1 && $ystatus != 1) { setuserscore($uid, C('ARTSCORE')); } $this->success('编辑文章成功!', U('Ucenter/userart')); } else { $this->error('编辑文章失败!'); } } else { $uid = is_login(); $id = I('id'); if (!is_admin($uid)) { $roleauth = getmroleauth($uid); // $setting['exts'] =$roleauth['fileext']; $extsarr = explode(',', $roleauth['fileext']); if (!empty($extsarr)) { $extstr = ''; foreach ($extsarr as $key1 => $vo1) { $extstr .= '*.' . $vo1 . ';'; } $this->assign('extstr', $extstr); } if (!getarteditauth($id, $uid)) { $this->error('无权编辑该文章或编辑时间已过', '', false, true); } } $info = callApi('Art/getArtInfo', array($id)); $info['data']['description'] = stripcslashes($info['data']['description']); $this->assign('info', $info['data']); $this->display(); } }
/** * 发布活动 * @param int $id * @param int $cover_id * @param string $title * @param string $explain * @param string $sTime * @param string $eTime * @param string $address * @param int $limitCount * @param string $deadline * autor:xjw129xjt */ public function doPost($id = 0, $cover_id = 0, $title = '', $explain = '', $sTime = '', $eTime = '', $address = '', $limitCount = 0, $deadline = '', $type_id = 0) { if (!is_login()) { $this->error('请登陆后再投稿。'); } if (!$cover_id) { $this->error('请上传封面。'); } if (trim(op_t($title)) == '') { $this->error('请输入标题。'); } if ($type_id == 0) { $this->error('请选择分类。'); } if (trim(op_h($explain)) == '') { $this->error('请输入内容。'); } if (trim(op_h($address)) == '') { $this->error('请输入地点。'); } if ($sTime < $deadline) { $this->error('报名截止不能大于活动开始时间'); } if ($deadline == '') { $this->error('请输入截止日期'); } if ($sTime > $eTime) { $this->error('活动开始时间不能大于活动结束时间'); } $content = D('Event')->create(); $content['explain'] = op_h($content['explain']); $content['title'] = op_t($content['title']); $content['sTime'] = strtotime($content['sTime']); $content['eTime'] = strtotime($content['eTime']); $content['deadline'] = strtotime($content['deadline']); $content['type_id'] = intval($type_id); if ($id) { $content_temp = D('Event')->find($id); if (!is_administrator(is_login())) { //不是管理员则进行检测 if ($content_temp['uid'] != is_login()) { $this->error('小样儿,可别学坏。别以为改一下页面元素就能越权操作。'); } } $content['uid'] = $content_temp['uid']; //权限矫正,防止被改为管理员 $rs = D('Event')->save($content); $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Event/Index/detail', array('id' => $id)); $weiboApi = new WeiboApi(); $weiboApi->resetLastSendTime(); $weiboApi->sendWeibo("我修改了活动【" . $title . "】:" . $postUrl); if ($rs) { $this->success('编辑成功。', U('detail', array('id' => $content['id']))); } else { $this->success('编辑失败。', ''); } } else { if (C('NEED_VERIFY') && !is_administrator()) { $content['status'] = 0; $tip = '但需管理员审核通过后才会显示在列表中,请耐心等待。'; $user = query_user(array('username', 'nickname'), is_login()); D('Common/Message')->sendMessage(C('USER_ADMINISTRATOR'), "{$user['nickname']}发布了一个活动,请到后台审核。", $title = '活动发布提醒', U('Admin/Event/verify'), is_login(), 2); } $rs = D('Event')->add($content); //同步到微博 $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Event/Index/detail', array('id' => $rs)); $weiboApi = new WeiboApi(); $weiboApi->resetLastSendTime(); $weiboApi->sendWeibo("我发布了一个新的活动【" . $title . "】:" . $postUrl); if ($rs) { $this->success('发布成功。' . $tip, U('index')); } else { $this->success('发布失败。', ''); } } }
public function addEvents() { if (!is_login()) { $this->apiError('请登陆后再发起活动。'); } $aStime = I('sTime'); $aDeadline = I('deadline'); $aAddress = I('address', '', 'op_h'); $aExplain = I('explain', '', 'op_h'); $aTypeId = I('type_id', '', 'intval'); $aTitle = I('title', '', 'op_t'); $aCover_id = I('cover_id', 0, 'intval'); $aEtime = I('eTime'); $aLimitCount = I('limitCount', 0, 'intval'); $aId = I('id', 0, 'intval'); if (!$aCover_id) { $this->apiError('请上传封面。'); } if (!$aLimitCount) { $this->apiError('请输入限制人数。'); } if (trim(op_t($aTitle)) == '') { $this->apiError('请输入标题。'); } if ($aTypeId == 0) { $this->apiError('请选择分类。'); } if (trim(op_h($aExplain)) == '') { $this->apiError('请输入内容。'); } if (trim(op_h($aAddress)) == '') { $this->apiError('请输入地点。'); } if (trim(op_h($aAddress)) == '') { $this->apiError('请输入地点。'); } if ($aStime < $aDeadline) { $this->apiError('报名截止不能大于活动开始时间'); } if ($aDeadline == '') { $this->apiError('请输入截止日期'); } if ($aStime > $aEtime) { $this->apiError('活动开始时间不能大于活动结束时间'); } $data = D('Event/Event')->create(); $data['explain'] = $aExplain; $data['title'] = $aTitle; $data['sTime'] = $aStime; $data['eTime'] = $aEtime; $data['cover_id'] = $aCover_id; $data['deadline'] = $aDeadline; $data['type_id'] = $aTypeId; $data['address'] = $aAddress; $data['limitCount'] = $aLimitCount; $data['create_time'] = time(); $data['update_time'] = time(); $data['uid'] = is_login(); //根据id查看是否已有活动 if ($aId) { $contentAlready = D('Event/Event')->find($aId); if (!is_administrator(is_login())) { //不是管理员则进行检测 if ($contentAlready['uid'] != is_login()) { $this->apierror('无权编辑'); } } $result = D('Event/Event')->where(array('id' => $aId))->save($data); if (D('Common/Module')->isInstalled('Weibo')) { //安装了微博模块 //同步到微博 $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Event/Index/detail', array('id' => $aId)); $weiboModel = D('Weibo/Weibo'); $weiboModel->addWeibo("我发布了一个新的活动【" . $aTitle . "】:" . $postUrl); } if ($result) { $this->apisuccess('编辑成功。', U('detail', array('id' => $data['id']))); } else { $this->apisuccess('编辑失败。', ''); } } else { if (modC('NEED_VERIFY', 1, 'event') && !is_administrator()) { $content['status'] = 0; $user = query_user(array('username', 'nickname'), is_login()); D('Common/Message')->sendMessage(C('USER_ADMINISTRATOR'), "{$user['nickname']}发布了一个活动,请到后台审核。", $title = '活动发布提醒', U('Admin/Event/verify'), is_login(), 2); } $Event = D('Event/Event')->add($data); //同步到微博 if (D('Common/Module')->isInstalled('Weibo')) { //安装了微博模块 //同步到微博 $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('Event/Index/detail', array('id' => $aId)); $weiboModel = D('Weibo/Weibo'); $weiboModel->addWeibo("我发布了一个新的活动【" . $aTitle . "】:" . $postUrl); } if ($Event) { $this->apisuccess('发布成功。但需管理员审核通过后才会显示在列表中,请耐心等待。'); } else { $this->apisuccess('发布失败。', ''); } } }
function html($text) { return op_h($text); }
public function doPost($id = 0, $cover_id = 0, $title = '', $content = '', $issue_id = 0, $url = '') { if (!check_auth('addIssueContent')) { $this->error('抱歉,您不具备投稿权限。'); } $issue_id = intval($issue_id); if (!is_login()) { $this->error('请登陆后再投稿。'); } if (!$cover_id) { $this->error('请上传封面。'); } if (trim(op_t($title)) == '') { $this->error('请输入标题。'); } if (trim(op_h($content)) == '') { $this->error('请输入内容。'); } if ($issue_id == 0) { $this->error('请选择分类。'); } if (trim(op_h($url)) == '') { $this->error('请输入网址。'); } $content = D('IssueContent')->create(); $content['content'] = filter_content($content['content']); $content['title'] = op_t($content['title']); $content['url'] = op_t($content['url']); //新增链接框 $content['issue_id'] = $issue_id; if ($id) { $content_temp = D('IssueContent')->find($id); if (!check_auth('editIssueContent')) { //不是管理员则进行检测 if ($content_temp['uid'] != is_login()) { $this->error('不可操作他人的内容。'); } } $content['uid'] = $content_temp['uid']; //权限矫正,防止被改为管理员 $rs = D('IssueContent')->save($content); if ($rs) { $this->success('编辑成功。', U('issueContentDetail', array('id' => $content['id']))); } else { $this->success('编辑失败。', ''); } } else { if (modC('NEED_VERIFY', 0) && !is_administrator()) { $content['status'] = 0; $tip = '但需管理员审核通过后才会显示在列表中,请耐心等待。'; $user = query_user(array('nickname'), is_login()); $admin_uids = explode(',', C('USER_ADMINISTRATOR')); foreach ($admin_uids as $admin_uid) { D('Common/Message')->sendMessage($admin_uid, $title = '专辑投稿提醒', "{$user['nickname']}向专辑投了一份稿件,请到后台审核。", 'Admin/Issue/verify', array(), is_login(), 2); } } $rs = D('IssueContent')->add($content); if ($rs) { $this->success('投稿成功。' . $tip, 'refresh'); } else { $this->success('投稿失败。', ''); } } }
/** * 执行添加信息 */ public function doAddInfo() { unset($_POST['__hash__']); $entity_id = I('post.entity_id', 0, 'intval'); $info_id = I('post.info_id', 0, 'intval'); $aOverTime = I('post.over_time', '', 'op_t'); $entity = M('cat_entity')->find($entity_id); /**权限认证**/ $can_post = CheckCanPostEntity(is_login(), $entity_id); if (!$can_post) { $this->error('对不起,您无权发布。'); } /**权限认证end*/ $info['title'] = I('post.title', '', 'op_t'); if ($info['title'] == '') { $this->error('必须输入标题'); } if (mb_strlen($info['title'], 'utf-8') > 40) { $this->error('标题过长。'); } $info['create_time'] = time(); if ($info_id != 0) { //保存逻辑 $info = M('cat_info')->find($info_id); $this->checkAuth('Cat/Index/editInfo', $info['uid'], '你没有编辑该条信息的权限!'); $this->checkActionLimit('cat_edit_info', 'cat_info', $info['id']); if ($aOverTime != '') { $info['over_time'] = strtotime($aOverTime); } $info['id'] = $info_id; $res = M('cat_info')->save($info); $rs_info = $info['id']; if ($res) { action_log('cat_edit_info', 'cat_info', $info['id']); } } else { $this->checkAuth('Cat/Index/addInfo', -1, '你没有发布信息的权限!'); $this->checkActionLimit('cat_add_info', 'cat_info'); //新增逻辑 $info['entity_id'] = $entity_id; $info['uid'] = is_login(); if ($entity['need_active'] && !is_administrator()) { $info['status'] = 2; } else { $info['status'] = 1; } if (isset($_POST['over_time'])) { $info['over_time'] = strtotime($_POST['over_time']); } $rs_info = M('cat_info')->add($info); if ($rs_info) { action_log('cat_add_info', 'cat_info'); } } $rs_data = 1; if ($rs_info != 0) { if ($info_id != 0) { $map_data['info_id'] = $info_id; M('Data')->where($map_data)->delete(); } $dataModel = M('Data'); foreach ($_POST as $key => $v) { if ($key != 'entity_id' && $key != 'over_time' && $key != 'ignore' && $key != 'info_id' && $key != 'title' && $key != '__hash__' && $key != 'file') { if (is_array($v)) { $rs_data = $rs_data && $dataModel->addData($key, implode(',', $v), $rs_info, $entity_id); } else { $v = op_h($v); $rs_data = $rs_data && $dataModel->addData($key, $v, $rs_info, $entity_id); } } if ($rs_data == 0) { $this->error($dataModel->getError()); } } if ($rs_info && $rs_data) { $this->assign('jumpUrl', U('Cat/Index/info', array('info_id' => $rs_info))); if ($entity['need_active']) { $this->success('发布成功。' . cookie('score_tip') . ' 请耐心等待管理员审核。通过审核后该信息将出现在前台页面中。'); } else { if ($entity['show_nav']) { if (M('Common/Module')->isInstalled('Weibo')) { //安装了轻博客模块 $postUrl = "http://{$_SERVER['HTTP_HOST']}" . U('cat/index/info', array('info_id' => $rs_info), null, true); $weiboModel = M('Weibo/Weibo'); $weiboModel->addWeibo("我发布了一个新的 " . $entity['alias'] . "信息 【" . $info['title'] . "】:" . $postUrl); } } $this->success('发布成功。' . cookie('score_tip')); } } } else { $this->error('发布失败。'); } }
public function keyHtml($name, $title, $width = '150px') { return $this->key($name, op_h($title), 'html', null, $width); }
/** * 提交内容 * @param integer $id [description] * @param integer $cover_id [description] * @param string $title [description] * @param string $content [description] * @param integer $issue_id [description] * @param string $url [description] * @return void */ public function content_post($id = 0, $cover_id = 0, $title = '', $content = '', $issue_id = 0, $url = '') { if (!check_auth('addIssueContent')) { $this->error('抱歉,您不具备投稿权限。'); } $issue_id = intval($issue_id); if (!is_login()) { $this->error('请登陆后再投稿。'); } $cover_id = intval($cover_id); // if ($cover_id<=0) { // $this->error('请上传封面。'); // } if (($title = trim(op_t($title))) == '') { $this->error('请输入标题。'); } if (($content = trim(op_h($content))) == '') { $this->error('请输入内容。'); } if ($issue_id == 0) { $this->error('请选择分类。'); } $url = trim(op_h($url)); $data = array(); $data['content'] =& $content; $data['title'] =& $title; $data['url'] =& $url; //新增链接框 $data['issue_id'] =& $issue_id; $data['cover_id'] =& $cover_id; $data = D('Issue/IssueContent')->create($data); if ($data === false) { $this->error(D('Issue/IssueContent')->getError()); } if ($id) { $temp = D('Issue/IssueContent')->find($id); if (!check_auth('editIssueContent')) { //不是管理员则进行检测 if ($temp['uid'] != is_login()) { $this->error('不可操作他人的内容。'); } } $data['uid'] = $temp['uid']; //权限矫正,防止被改为管理员 $rs = D('Issue/IssueContent')->where(array('id' => $temp['id']))->save($data); if ($rs) { $this->success('编辑成功。', U('contents')); } else { $this->success('编辑失败。', ''); } } else { if (modC('NEED_VERIFY', 0) && !is_administrator()) { //需要审核且不是管理员 $data['status'] = 0; $tip = '但需管理员审核通过后才会显示在列表中,请耐心等待。'; $user = query_user(array('nickname'), is_login()); $admin_uids = explode(',', C('USER_ADMINISTRATOR')); foreach ($admin_uids as $admin_uid) { D('Common/Message')->sendMessage($admin_uid, "{$user['nickname']}向专辑投了一份稿件,请到后台审核。", '专辑投稿提醒', U('Admin/Issue/verify'), is_login(), 2); } } $rs = D('Issue/IssueContent')->add($data); if ($rs) { $this->success('投稿成功。' . $tip, U('contents')); } else { $this->success('投稿失败。', ''); } } }
/** * @param $goods_id * @param $resource * @return mixed * @auth 陈一枭 */ private function getResourceData($goods_id, $resource) { $resource['id'] = $goods_id; $resource['etitle'] = op_t(I('post.etitle')); $resource['instruction'] = op_h(I('post.instruction', '', 'html')); return $resource; }