coginiAction.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. class coginiClassAction extends Action
  3. {
  4. public function phpiniAction()
  5. {
  6. }
  7. public function phpinishowAction()
  8. {
  9. }
  10. public function phpinisaveAction()
  11. {
  12. if(getconfig('systype')=='demo')return returnerror('演示禁止操作');
  13. $path = trim($this->post('path'));
  14. if(!$path || !file_exists($path))return returnerror('无权限设置,请找到对应文件修改'.$path.'');
  15. if(substr($path, -4)!='.ini')return returnerror('无效');
  16. $cont = @file_get_contents($path);
  17. if(!$cont)return returnerror('无权限获取'.$path.'内容');
  18. $str = '';
  19. $conta= explode("\n", $cont);
  20. foreach($conta as $k=>$s){
  21. if($k>0)$str.=chr(10);
  22. $s2 = $s;
  23. $s1 = '';
  24. if($s){
  25. $s1 = $this->phpinisave($s,'upload_max_filesize');
  26. if(!$s1)$s1 = $this->phpinisave($s,'post_max_size');
  27. if(!$s1)$s1 = $this->phpinisave($s,'memory_limit');
  28. if(!$s1)$s1 = $this->phpinisave($s,'max_execution_time');
  29. if(!$s1)$s1 = $this->phpinisave($s,'max_input_vars');
  30. if(!$s1)$s1 = $this->phpinisave($s,'html_errors', false, 'On');
  31. if(!$s1)$s1 = $this->phpinisave($s,'error_log', true);
  32. if(!$s1)$s1 = $this->phpinisave($s,'upload_tmp_dir', true);
  33. }
  34. if($s1)$s2 = $s1;
  35. $str.=$s2;
  36. }
  37. $bo = @file_put_contents($path, $str);
  38. if(!$bo)return returnerror('无权限写入'.$path.'');
  39. return returnsuccess();
  40. }
  41. private function phpinisave($s1,$key,$ybo=false,$sv='')
  42. {
  43. if(contain($s1,$key) && contain($s1,'=')){
  44. $val = trim($this->post($key));
  45. if(!$val)$val = $sv;
  46. if(!$val)return '';
  47. if($ybo)$val = '"'.$val.'"';
  48. return ''.$key.' = '.$val.'';
  49. }
  50. return '';
  51. }
  52. public $publicfile = 'include/langlocal/langtxt/';
  53. public function langcogAction()
  54. {
  55. return '授权版可用';
  56. }
  57. public function phperrAction()
  58. {
  59. echo '<title>PHP错误信息查看</title>';
  60. $path = @ini_get('error_log');
  61. if(!$path)return '未设置记录php错误路径,去<a href="'.URLY.'view_phperr.html">看看</a>如何设置。';
  62. $cont = '无内容';
  63. if(file_exists($path) && getconfig('systype')!='demo'){
  64. $cont = @file_get_contents($path);
  65. $str = '';
  66. if($cont){
  67. $arr = explode("\n", $cont);
  68. $len = count($arr);
  69. for($i=0;$i<$len;$i++){
  70. $str1 = $arr[$i];
  71. $str2 = str_replace('\\','/', $str1);
  72. if(contain($str2, ROOT_PATH)){
  73. if($str)$str.='<hr>';
  74. $str.=$str1;
  75. }
  76. }
  77. }
  78. $cont = $str;
  79. }
  80. return $cont;
  81. }
  82. }
粤ICP备19079148号