-
Notifications
You must be signed in to change notification settings - Fork 0
/
ppostedit.php
76 lines (68 loc) · 3.19 KB
/
ppostedit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* 用户会客室帖子编辑
*
* 编辑一个帖子主题或者回复,支持UBB代码
*
* 调用模板:/templates/passedit.html
*
* @category jieqicms
* @package system
* @copyright Copyright (c) Hangzhou Jieqi Network Technology Co.,Ltd. (http://www.jieqi.com)
* @author $Author: juny $
* @version $Id: ppostedit.php 344 2009-06-23 03:06:07Z juny $
*/
define('JIEQI_MODULE_NAME', 'system');
require_once('global.php');
jieqi_checklogin();
if(empty($_REQUEST['pid']) || !is_numeric($_REQUEST['pid'])) jieqi_printfail(LANG_ERROR_PARAMETER);
jieqi_loadlang('parlar', JIEQI_MODULE_NAME);
include_once(JIEQI_ROOT_PATH.'/class/pposts.php');
$pposts_handler =& JieqiPpostsHandler::getInstance('JieqiPpostsHandler');
$ppost=$pposts_handler->get($_REQUEST['pid']);
if(!$ppost) jieqi_printfail($jieqiLang['system']['ppost_not_exists']);
//检查权限(管理)
if($ppost->getVar('posterid') != $_SESSION['jieqiUserId']) jieqi_printfail($jieqiLang['system']['ppost_edit_noper']);
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
if (!isset($_REQUEST['action'])) $_REQUEST['action'] = 'edit';
//主题处理相关函数
include_once(JIEQI_ROOT_PATH.'/include/funpost.php');
switch($_REQUEST['action']){
case 'update':
//校验错误信息数组
$check_errors = array();
//检查和过滤提交变量
$post_set = array('module'=>JIEQI_MODULE_NAME, 'ownerid'=>intval($ppost->getVar('ownerid')), 'topicid'=>intval($ppost->getVar('topicid')), 'postid'=>intval($ppost->getVar('postid')), 'posttime'=>intval($ppost->getVar('posttime','n')), 'topictitle'=>&$_POST['ptitle'], 'posttext'=>&$_POST['pcontent'], 'attachment'=>'', 'emptytitle'=>true, 'isnew'=>false, 'istopic'=>intval($ppost->getVar('istopic')), 'istop'=>0, 'sname'=>'jieqiSystemParlorTime', 'attachfile'=>'', 'oldattach'=>'', 'checkcode'=>$_POST['checkcode']);
jieqi_post_checkvar($post_set, $jieqiConfigs['system'], $check_errors);
if(empty($check_errors)) {
$oldtitle=$ppost->getVar('subject', 'n');
//更新帖子表
jieqi_post_upedit($post_set, jieqi_dbprefix('system_pposts'));
//如果是主题则更新主题表
if ($ppost->getVar('istopic')==1 && $post_set['topictitle'] != $oldtitle){
jieqi_topic_upedit($post_set, jieqi_dbprefix('system_ptopics'));
}
jieqi_jumppage(JIEQI_URL.'/ptopicshow.php?tid='.$ppost->getVar('topicid'), LANG_DO_SUCCESS, $jieqiLang['system']['ppost_edit_success']);
}else{
jieqi_printfail(implode('<br />', $check_errors));
}
break;
case 'edit':
default:
include_once(JIEQI_ROOT_PATH.'/header.php');
$jieqiTpl->assign('subject', $ppost->getVar('subject'));
$jieqiTpl->assign('topicid', $ppost->getVar('topicid'));
$jieqiTpl->assign('postid', $ppost->getVar('postid'));
$jieqiTpl->assign('url_ppostedit', 'ppostedit.php?do=submit');
$jieqiTpl->assign('ptitle', $ppost->getVar('subject', 'e'));
$jieqiTpl->assign('pcontent', $ppost->getVar('posttext', 'e'));
//是否显示验证码
if(!isset($jieqiConfigs['system'])) jieqi_getconfigs('system', 'configs');
$jieqiTpl->assign('postcheckcode', $jieqiConfigs['system']['postcheckcode']);
$jieqiTpl->assign('pid', $_REQUEST['pid']);
$jieqiTpl->setCaching(0);
$jieqiTset['jieqi_contents_template'] = JIEQI_ROOT_PATH.'/templates/ppostedit.html';
include_once(JIEQI_ROOT_PATH.'/footer.php');
break;
}
?>