load->helper(array('form', 'url')); $this->load->model('user_model'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } } public function import() { $data['page_title'] = "LoTW ADIF Import"; $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'adi|ADI'; $this->load->library('upload', $config); if ($this->input->post('lotwimport') == 'fetch') { // Probably need something like // $this->load->library('arrl_lotw'); // $this->arrl_lotw->fetch_report(someargs) // Then dump that file into the uploads directory // Then continue on with the below code using the file that // got fetched instead of the uploaded one. // $xml = file_get_contents("http://www.example.com/file.xml"); // http://us.php.net/manual/en/function.file.php $file = $config['upload_path'] . 'lotwreport_download.adi'; file_put_contents($file, file_get_contents("https://p1k.arrl.org/lotwuser/lotwreport.adi?login=______&password=______&qso_query=1")); } else { if ( ! $this->upload->do_upload()) { $data['error'] = $this->upload->display_errors(); $this->load->view('layout/header', $data); $this->load->view('lotw/import'); $this->load->view('layout/footer'); } else { $data = array('upload_data' => $this->upload->data()); ini_set('memory_limit', '-1'); set_time_limit(0); $this->load->model('logbook_model'); $this->load->library('adif_parser'); $this->adif_parser->load_from_file('./uploads/'.$data['upload_data']['file_name']); $this->adif_parser->initialize(); $table = "
".$time_on." | "; $table .= "".$record['call']." | "; $table .= "".$record['mode']." | "; $table .= "".$record['qsl_rcvd']." | "; $table .= "".$qsl_date." | "; $table .= "QSO Record: ".$status." | "; $table .= "LoTW Record: ".$lotw_status." | "; $table .= "