diff --git a/application/controllers/Update.php b/application/controllers/Update.php index 6219af31..545ed667 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -31,11 +31,22 @@ class Update extends CI_Controller { $count = 0; foreach ($xml_data->entities->entity as $entity) { - $startinfo = strtotime($record->start); - $endinfo = strtotime($record->end); + + if(isset($record->start)) { + $startinfo = strtotime($record->start); + $start_date = ($startinfo) ? date('Y-m-d H:i:s',$startinfo) : ""; + } else { + $start_date = NULL; + } + + if (isset($record->end)) { + $endinfo = strtotime($record->end); + $end_date = ($endinfo) ? date('Y-m-d H:i:s',$endinfo) : ""; + } else { + $end_date = NULL; + } + - $start_date = ($startinfo) ? date('Y-m-d H:i:s',$startinfo) : ""; - $end_date = ($endinfo) ? date('Y-m-d H:i:s',$endinfo) : ""; if(!$entity->cqz) { $data = array( @@ -77,11 +88,19 @@ class Update extends CI_Controller { $count = 0; foreach ($xml_data->exceptions->exception as $record) { - $startinfo = strtotime($record->start); - $endinfo = strtotime($record->end); - - $start_date = ($startinfo) ? date('Y-m-d H:i:s',$startinfo) : ""; - $end_date = ($endinfo) ? date('Y-m-d H:i:s',$endinfo) : ""; + if(isset($record->start)) { + $startinfo = strtotime($record->start); + $start_date = date('Y-m-d H:i:s',$startinfo); + } else { + $start_date = NULL; + } + + if (isset($record->end)) { + $endinfo = strtotime($record->end); + $end_date = date('Y-m-d H:i:s',$endinfo); + } else { + $end_date = NULL; + } $data = array( 'record' => (int) $record->attributes()->record, @@ -97,6 +116,7 @@ class Update extends CI_Controller { ); $this->db->insert('dxcc_exceptions', $data); + $count += 1; if ($count % 10 == 0) $this->update_status(); @@ -117,11 +137,20 @@ class Update extends CI_Controller { $count = 0; foreach ($xml_data->prefixes->prefix as $record) { - $startinfo = strtotime($record->start); - $endinfo = strtotime($record->end); - - $start_date = ($startinfo) ? date('Y-m-d H:i:s',$startinfo) : ""; - $end_date = ($endinfo) ? date('Y-m-d H:i:s',$endinfo) : ""; + if(isset($record->start)) { + $startinfo = strtotime($record->start); + $start_date = date('Y-m-d H:i:s',$startinfo); + } else { + $start_date = NULL; + } + + if (isset($record->end)) { + $endinfo = strtotime($record->end); + $end_date = date('Y-m-d H:i:s',$endinfo); + } else { + $end_date = NULL; + } + $data = array( 'record' => (int) $record->attributes()->record,