spacecp_class.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: spacecp_class.php 25246 2011-11-02 03:34:53Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $classid = empty($_GET['classid'])?0:intval($_GET['classid']);
  12. $op = empty($_GET['op'])?'':$_GET['op'];
  13. $class = array();
  14. if($classid) {
  15. $class = C::t('home_class')->fetch($classid);
  16. if($class['uid'] != $_G['uid']) {
  17. $class = null;
  18. }
  19. }
  20. if(empty($class)) showmessage('did_not_specify_the_type_of_operation');
  21. if ($op == 'edit') {
  22. if(submitcheck('editsubmit')) {
  23. $_POST['classname'] = getstr($_POST['classname'], 40);
  24. $_POST['classname'] = censor($_POST['classname']);
  25. if(strlen($_POST['classname']) < 1) {
  26. showmessage('enter_the_correct_class_name');
  27. }
  28. C::t('home_class')->update($classid, array('classname'=>$_POST['classname']));
  29. showmessage('do_success', dreferer(),array('classid'=>$classid, 'classname' => $_POST['classname']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
  30. }
  31. } elseif ($op == 'delete') {
  32. if(submitcheck('deletesubmit')) {
  33. C::t('home_blog')->update_classid_by_classid($classid, 0);
  34. C::t('home_class')->delete($classid);
  35. showmessage('do_success', dreferer());
  36. }
  37. }
  38. include_once template("home/spacecp_class");
  39. ?>