'. PHP_EOL; echo ' '. PHP_EOL; echo '

RaSCSI - 68kmla Edition

'. PHP_EOL; echo ' '. PHP_EOL; echo '
'. PHP_EOL; echo ' '. PHP_EOL; if($GLOBALS['DEBUG_ENABLE']){ echo '

Debug Timestamp: '.time().'

'. PHP_EOL; } echo '
'. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; //echo(exec('whoami')); } function html_generate_image_file_select_list(){ $all_files = get_all_files(); foreach(explode(PHP_EOL, $all_files) as $this_file){ if(strpos($this_file, 'total') === 0){ continue; } $file_name = file_name_from_ls($this_file); if(strlen($file_name) === 0){ continue; } // Ignore files that start with a . if(strpos($file_name, '.') === 0){ continue; } echo ''.PHP_EOL; } } function html_generate_scsi_id_select_list(){ echo ''. PHP_EOL; } function html_generate_scsi_type_select_list(){ echo ''. PHP_EOL; } function html_generate_warning($message){ echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo '
'. PHP_EOL; echo ' '.$message.''. PHP_EOL; echo '
'. PHP_EOL; } function html_generate_success_message($message){ echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; if(strlen($message) > 0){ echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; } echo '
'. PHP_EOL; echo ' Success'. PHP_EOL; echo '
'. PHP_EOL; echo ' '.$message.PHP_EOL; echo '
'. PHP_EOL; } function html_generate_ok_to_go_home(){ echo '
'. PHP_EOL; echo ' '. PHP_EOL; echo '
'. PHP_EOL; } function current_rascsi_config() { $raw_output = shell_exec("/usr/local/bin/rasctl -l"); $rasctl_lines = explode(PHP_EOL, $raw_output); echo '
'. PHP_EOL; echo '

Current RaSCSI Configuration

'. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; $scsi_ids = array(); foreach ($rasctl_lines as $current_line) { if(strlen($current_line) === 0){ continue; } if(strpos($current_line, '+----') === 0){ continue; } if(strpos($current_line, '| ID | UN') === 0){ continue; } $segments = explode("|", $current_line); $id_config = array(); $id_config['id'] = trim($segments[1]); $id_config['type'] = trim($segments[3]); $id_config['file'] = trim($segments[4]); $scsi_ids[$id_config['id']] = $id_config; } foreach (range(0,7) as $id){ echo ' '. PHP_EOL; echo ' '. PHP_EOL; if(isset($scsi_ids[$id])) { echo ' '. PHP_EOL; if(strtolower($scsi_ids[$id]['file']) == "no media"){ echo ' '.PHP_EOL; } else{ // rascsi inserts "WRITEPROTECT" for the read-only drives. We want to display that differently. echo ' '. PHP_EOL; echo ' '.PHP_EOL; echo ' '. PHP_EOL; } echo ' '. PHP_EOL; } else { echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; } echo ' '. PHP_EOL; echo ' '. PHP_EOL; } echo '
SCSI IDTypeFileFile OpsDevice Ops
'.$id.''.$scsi_ids[$id]['type'].''.PHP_EOL; echo '
'. PHP_EOL; echo ' '.PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo '
'.PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo '
'.str_replace('(WRITEPROTECT)', '', $scsi_ids[$id]['file']). PHP_EOL; echo ' '.PHP_EOL; if(strtolower($scsi_ids[$id]['type']) == 'sccd'){ echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; } echo ' '. PHP_EOL; echo '
'. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo '
'. PHP_EOL; echo '
--'. PHP_EOL; echo '
'. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo ' '. PHP_EOL; echo '
'. PHP_EOL; echo '
'. PHP_EOL; } function get_all_files() { $raw_ls_output = shell_exec('ls --time-style="+\"%Y-%m-%d %H:%M:%S\"" -alh --quoting-style=c '.$GLOBALS['FILE_PATH']); return $raw_ls_output; } function mod_date_from_ls($value){ $ls_pieces = explode("\"", $value); if(count($ls_pieces)<1){ return ""; } return $ls_pieces[1]; } function file_name_from_ls($value){ $ls_pieces = explode("\"", $value); if(count($ls_pieces) < 4){ return ""; } return $ls_pieces[3]; } function file_size_from_ls($value){ $ls_pieces = explode("\"", $value); $file_props = preg_split("/\s+/", $ls_pieces[0]); return $file_props[4]; } function file_category_from_file_name($value){ if(strpos($value,".iso") > 0){ return "CD-ROM Image"; } if(strpos($value,".hda") > 0){ return "Hard Disk Image"; } return "Unknown type: " . $value; } function type_string_to_rasctl_type($typestr){ if(strcasecmp($typestr,"Hard Disk") == 0){ return "hd"; } if(strcasecmp($typestr,"CD-ROM") == 0){ return "cd"; } if(strcasecmp($typestr,"Zip Drive") == 0){ } if(strcasecmp($typestr,"Filesystem bridge") == 0){ return "bridge"; } return ""; } ?>