manage.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * tt管理工具
  4. * 作者:于斌
  5. */
  6. #管理接口
  7. if($config['request']['type'] == 'new')
  8. {
  9. }
  10. elseif($config['request']['type'] == 'newaction')
  11. {
  12. if($config['request']['name'])
  13. {
  14. $file = TT_CONFIG_PATH . $config['request']['name'].'.php';
  15. if(is_file($file))
  16. {
  17. echo '项目已存在';die;
  18. }
  19. file_put_contents($file, '<?php #'. date('Y-m-d H:i:s') . 'ttserver管理工具创建'."\n" );
  20. echo '创建成功';die;
  21. }
  22. else
  23. {
  24. echo '项目名称不能为空';die;
  25. }
  26. }
  27. elseif($config['request']['type'] == 'set')
  28. {
  29. $file = TT_CONFIG_PATH . $config['request']['name'].'.php';
  30. $manage['name'] = $config['request']['name'];
  31. $manage['data'] = file_get_contents($file);
  32. }
  33. elseif($config['request']['type'] == 'edit')
  34. {
  35. $file = TT_CONFIG_PATH . $config['request']['name'].'.php';
  36. $data = str_replace('\\','', $config['request']['content']);
  37. if(is_file($file))
  38. {
  39. $state = file_put_contents($file, $data);
  40. }
  41. else
  42. {
  43. $state = false;
  44. }
  45. echo '编辑成功';die;
  46. }
  47. elseif($config['request']['type'] == 'data')
  48. {
  49. }
  50. else
  51. {
  52. $path = TT_CONFIG_PATH;
  53. if(is_dir($path))
  54. {
  55. $manage['path'] = scandir($path);
  56. }
  57. }