本文整理汇总了PHP中op_h函数的典型用法代码示例。如果您正苦于以下问题:PHP op_h函数的具体用法?PHP op_h怎么用?PHP op_h使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了op_h函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterPostContent
private function filterPostContent($content)
{
$content = op_h($content);
$content = $this->limitPictureCount($content);
$content = op_h($content);
return $content;
}
示例2: filter_post_content
function filter_post_content($content)
{
$content = op_h($content);
$content = limit_picture_count($content);
$content = op_h($content);
return $content;
}
示例3: render
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;
}
示例4: render
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;
}
示例5: doSendIssue
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);
}
示例6: doAddInfo
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 {
//.........这里部分代码省略.........
示例7: history
/**
* 邮件发送历史
* @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'));
}
示例8: addComment
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('评论成功');
}
}
示例9: keyHtml
public function keyHtml($name, $title)
{
return $this->key($name, op_h($title), 'html');
}
示例10: doPost
/**
* 发布活动
* @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('发布失败。', '');
}
}
}
示例11: getIssueDetail
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);
}
示例12: getpcomment
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);
}
示例13: doPost
/**
* 发布活动
* @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 {
//.........这里部分代码省略.........
示例14: addGroup
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('发布失败。');
}
}
}
示例15: artedit
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();
}
}