spacecp_class.php
1.36 KB
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
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_class.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$classid = empty($_GET['classid'])?0:intval($_GET['classid']);
$op = empty($_GET['op'])?'':$_GET['op'];
$class = array();
if($classid) {
$class = C::t('home_class')->fetch($classid);
if($class['uid'] != $_G['uid']) {
$class = null;
}
}
if(empty($class)) showmessage('did_not_specify_the_type_of_operation');
if ($op == 'edit') {
if(submitcheck('editsubmit')) {
$_POST['classname'] = getstr($_POST['classname'], 40);
$_POST['classname'] = censor($_POST['classname']);
if(strlen($_POST['classname']) < 1) {
showmessage('enter_the_correct_class_name');
}
C::t('home_class')->update($classid, array('classname'=>$_POST['classname']));
showmessage('do_success', dreferer(),array('classid'=>$classid, 'classname' => $_POST['classname']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
} elseif ($op == 'delete') {
if(submitcheck('deletesubmit')) {
C::t('home_blog')->update_classid_by_classid($classid, 0);
C::t('home_class')->delete($classid);
showmessage('do_success', dreferer());
}
}
include_once template("home/spacecp_class");
?>