<?php
include_once("c_debug_info.php");
include_once(_DIR_TO_MODULES.'/engine/i_disk.php') ;
class c_page_cab_debug_info_shell extends c_page_cab_debug_info
{
  public $h1='Выполнение exec' ;


  function block_main()
  { $this->page_title() ;
     ?><form>
       <input name=shell_cmd style="width:100%;" value="<?echo htmlspecialchars($_POST['shell_cmd'])?>"><br><br>
       <input  class=v1 cmd=execShell type="submit" value="Выполнить"><br><br>
     </form><?
    if ($_POST['cmd']=='execShell')
    {   $result = ENGINE()->liveExecuteCommand($_POST['shell_cmd']);
        ?><textarea style="width:100%;height:500px;"><?echo $result['output'] ;?></textarea><?
        $temp_fname='shell_result_'.time().'.txt' ;
 	    if (file_exists(_TEMP_DIR.'/'.$temp_fname)) unlink(_TEMP_DIR.'/'.$temp_fname) ;
 	    file_put_contents(_TEMP_DIR.'/'.$temp_fname,$result['output']) ;
        LOGS()->reg_log('shell_command_from_cab',$_POST['shell_cmd'].'<br><a href="/temp/'.$temp_fname.'" target=_blank>Результат операции</a>') ;
    }


  }
  
}



?>