2019-08-13 20:22:06 +00:00
|
|
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Data lookup functions used within Cloudlog
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Lookup extends CI_Controller {
|
|
|
|
|
2019-10-05 18:35:55 +00:00
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$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'); }
|
|
|
|
}
|
|
|
|
|
2019-08-13 20:22:06 +00:00
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-08-15 10:53:32 +00:00
|
|
|
public function scp($call) {
|
|
|
|
|
|
|
|
// SCP results from logbook
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
|
|
|
$log_calls = $this->logbook_model->get_callsigns($call);
|
|
|
|
|
|
|
|
if($log_calls != "") {
|
2019-08-15 10:57:56 +00:00
|
|
|
echo $log_calls ." ";
|
2019-08-15 10:53:32 +00:00
|
|
|
}
|
|
|
|
|
2019-10-09 12:54:07 +00:00
|
|
|
$arCalls = array();
|
2019-08-15 10:53:32 +00:00
|
|
|
|
|
|
|
// SCP results from master scp db
|
2019-08-13 20:22:06 +00:00
|
|
|
$file = 'updates/masterscp.txt';
|
|
|
|
|
2019-08-15 11:00:57 +00:00
|
|
|
if (is_readable($file)) {
|
2019-08-13 20:22:06 +00:00
|
|
|
|
2019-08-15 11:00:57 +00:00
|
|
|
$lines = file($file, FILE_IGNORE_NEW_LINES);
|
|
|
|
$input = preg_quote($call, '~');
|
2019-08-13 20:22:06 +00:00
|
|
|
|
2019-08-15 11:00:57 +00:00
|
|
|
$result = preg_grep('~' . $input . '~', $lines, 0);
|
2019-08-13 20:22:06 +00:00
|
|
|
|
2019-08-15 11:00:57 +00:00
|
|
|
foreach ($result as &$value) {
|
2019-10-09 12:54:07 +00:00
|
|
|
$arCalls[] = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SCP from Club Log
|
|
|
|
$file = "updates/clublog_scp.txt";
|
|
|
|
if (is_readable($file)) {
|
|
|
|
|
|
|
|
$lines = file($file, FILE_IGNORE_NEW_LINES);
|
|
|
|
|
|
|
|
foreach ($lines as $strCall)
|
|
|
|
{
|
|
|
|
if (in_array($strCall, $arCalls) == false)
|
|
|
|
{
|
|
|
|
$arCalls[] = $value;
|
|
|
|
}
|
2019-08-15 11:00:57 +00:00
|
|
|
}
|
2019-08-13 20:22:06 +00:00
|
|
|
}
|
|
|
|
|
2019-10-09 12:54:07 +00:00
|
|
|
sort($arCalls);
|
|
|
|
|
|
|
|
foreach ($arCalls as $strCall)
|
|
|
|
{
|
|
|
|
echo " " . $strCall . " ";
|
|
|
|
}
|
|
|
|
}
|
2019-08-15 10:54:18 +00:00
|
|
|
}
|