[eQSL] Cleaned up code formatting
这个提交包含在:
父节点
025b1de9fd
当前提交
bfca0459db
共有 1 个文件被更改,包括 198 次插入 和 169 次删除
|
|
@ -1,15 +1,18 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class eqsl extends CI_Controller {
|
||||
class eqsl extends CI_Controller
|
||||
{
|
||||
|
||||
/* Controls who can access the controller and its functions */
|
||||
function __construct() {
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper(array('form', 'url'));
|
||||
}
|
||||
|
||||
// Default view when loading controller.
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->lang->load('qslcard');
|
||||
$this->load->helper('storage');
|
||||
|
|
@ -27,9 +30,13 @@ class eqsl extends CI_Controller {
|
|||
$this->load->view('eqslcard/index');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
public function import() {
|
||||
public function import()
|
||||
{
|
||||
$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'); }
|
||||
if (!$this->user_model->authorize(2)) {
|
||||
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
|
||||
redirect('dashboard');
|
||||
}
|
||||
|
||||
$this->load->model('stations');
|
||||
$data['station_profile'] = $this->stations->all_of_user();
|
||||
|
|
@ -40,7 +47,7 @@ class eqsl extends CI_Controller {
|
|||
// Check if eQSL Nicknames have been defined
|
||||
$this->load->model('eqslmethods_model');
|
||||
$eqsl_locations = $this->eqslmethods_model->all_of_user_with_eqsl_nick_defined();
|
||||
if($eqsl_locations->num_rows() == 0) {
|
||||
if ($eqsl_locations->num_rows() == 0) {
|
||||
$this->session->set_flashdata('error', 'eQSL Nicknames in Station Profiles aren\'t defined!');
|
||||
}
|
||||
|
||||
|
|
@ -53,8 +60,7 @@ class eqsl extends CI_Controller {
|
|||
$this->load->library('upload', $config);
|
||||
|
||||
$eqsl_results = array();
|
||||
if ($this->input->post('eqslimport') == 'fetch')
|
||||
{
|
||||
if ($this->input->post('eqslimport') == 'fetch') {
|
||||
$this->load->library('EqslImporter');
|
||||
|
||||
// Get credentials for eQSL
|
||||
|
|
@ -63,13 +69,12 @@ class eqsl extends CI_Controller {
|
|||
$eqsl_password = $q->user_eqsl_password;
|
||||
|
||||
// Validate that eQSL credentials are not empty
|
||||
if ($eqsl_password == '')
|
||||
{
|
||||
if ($eqsl_password == '') {
|
||||
$this->session->set_flashdata('warning', 'You have not defined your eQSL.cc credentials!');
|
||||
redirect('eqsl/import');
|
||||
}
|
||||
|
||||
$eqsl_force_from_date = (!$this->input->post('eqsl_force_from_date')=="")?$this->input->post('eqsl_force_from_date'):"";
|
||||
$eqsl_force_from_date = (!$this->input->post('eqsl_force_from_date') == "") ? $this->input->post('eqsl_force_from_date') : "";
|
||||
foreach ($eqsl_locations->result_array() as $eqsl_location) {
|
||||
$this->eqslimporter->from_callsign_and_QTH(
|
||||
$eqsl_location['station_callsign'],
|
||||
|
|
@ -81,11 +86,10 @@ class eqsl extends CI_Controller {
|
|||
$eqsl_results[] = $this->eqslimporter->fetch($eqsl_password, $eqsl_force_from_date);
|
||||
}
|
||||
} elseif ($this->input->post('eqslimport') == 'upload') {
|
||||
$station_id4upload=$this->input->post('station_profile');
|
||||
$station_id4upload = $this->input->post('station_profile');
|
||||
if ($this->stations->check_station_is_accessible($station_id4upload)) {
|
||||
$station_callsign=$this->stations->profile($station_id4upload)->row()->station_callsign;
|
||||
if ( ! $this->upload->do_upload())
|
||||
{
|
||||
$station_callsign = $this->stations->profile($station_id4upload)->row()->station_callsign;
|
||||
if (!$this->upload->do_upload()) {
|
||||
$data['page_title'] = "eQSL Import";
|
||||
$data['error'] = $this->upload->display_errors();
|
||||
|
||||
|
|
@ -98,12 +102,12 @@ class eqsl extends CI_Controller {
|
|||
$data = array('upload_data' => $this->upload->data());
|
||||
|
||||
$this->load->library('EqslImporter');
|
||||
$this->eqslimporter->from_file('./uploads/'.$data['upload_data']['file_name'], $station_callsign, $station_id4upload);
|
||||
$this->eqslimporter->from_file('./uploads/' . $data['upload_data']['file_name'], $station_callsign, $station_id4upload);
|
||||
|
||||
$eqsl_results[] = $this->eqslimporter->import();
|
||||
}
|
||||
} else {
|
||||
log_message('error',$station_id4upload." is not valid for user!");
|
||||
log_message('error', $station_id4upload . " is not valid for user!");
|
||||
}
|
||||
} else {
|
||||
$data['page_title'] = "eQSL Import";
|
||||
|
|
@ -123,13 +127,17 @@ class eqsl extends CI_Controller {
|
|||
$this->load->view('interface_assets/footer');
|
||||
} // end function
|
||||
|
||||
public function export() {
|
||||
public function export()
|
||||
{
|
||||
$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'); }
|
||||
if (!$this->user_model->authorize(2)) {
|
||||
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
|
||||
redirect('dashboard');
|
||||
}
|
||||
|
||||
// Check if eQSL Nicknames have been defined
|
||||
$this->load->model('stations');
|
||||
if($this->stations->are_eqsl_nicks_defined() == 0) {
|
||||
if ($this->stations->are_eqsl_nicks_defined() == 0) {
|
||||
$this->session->set_flashdata('error', 'eQSL Nicknames in Station Profiles aren\'t defined!');
|
||||
}
|
||||
|
||||
|
|
@ -148,9 +156,9 @@ class eqsl extends CI_Controller {
|
|||
$data['user_eqsl_password'] = $q->user_eqsl_password;
|
||||
|
||||
// Validate that eQSL credentials are not empty
|
||||
if ($data['user_eqsl_name'] == '' || $data['user_eqsl_password'] == '')
|
||||
{
|
||||
$this->session->set_flashdata('warning', 'You have not defined your eQSL.cc credentials!'); redirect('eqsl/import');
|
||||
if ($data['user_eqsl_name'] == '' || $data['user_eqsl_password'] == '') {
|
||||
$this->session->set_flashdata('warning', 'You have not defined your eQSL.cc credentials!');
|
||||
redirect('eqsl/import');
|
||||
}
|
||||
|
||||
$rows = '';
|
||||
|
|
@ -169,17 +177,17 @@ class eqsl extends CI_Controller {
|
|||
$status = $this->uploadQso($adif, $qsl);
|
||||
|
||||
$timestamp = strtotime($qsl['COL_TIME_ON']);
|
||||
$rows .= "<td>".date($custom_date_format, $timestamp)."</td>";
|
||||
$rows .= "<td>".date('H:i', $timestamp)."</td>";
|
||||
$rows .= "<td>".str_replace("0","Ø",$qsl['COL_CALL'])."</td>";
|
||||
$rows .= "<td>".$qsl['COL_MODE']."</td>";
|
||||
if(isset($qsl['COL_SUBMODE'])) {
|
||||
$rows .= "<td>".$qsl['COL_SUBMODE']."</td>";
|
||||
$rows .= "<td>" . date($custom_date_format, $timestamp) . "</td>";
|
||||
$rows .= "<td>" . date('H:i', $timestamp) . "</td>";
|
||||
$rows .= "<td>" . str_replace("0", "Ø", $qsl['COL_CALL']) . "</td>";
|
||||
$rows .= "<td>" . $qsl['COL_MODE'] . "</td>";
|
||||
if (isset($qsl['COL_SUBMODE'])) {
|
||||
$rows .= "<td>" . $qsl['COL_SUBMODE'] . "</td>";
|
||||
} else {
|
||||
$rows .= "<td></td>";
|
||||
}
|
||||
$rows .= "<td>".$qsl['COL_BAND']."</td>";
|
||||
$rows .= "<td>".$status."</td>";
|
||||
$rows .= "<td>" . $qsl['COL_BAND'] . "</td>";
|
||||
$rows .= "<td>" . $status . "</td>";
|
||||
}
|
||||
$rows .= "</tr>";
|
||||
$data['eqsl_table'] = $this->generateResultTable($custom_date_format, $rows);
|
||||
|
|
@ -195,7 +203,8 @@ class eqsl extends CI_Controller {
|
|||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
function uploadQso($adif, $qsl) {
|
||||
function uploadQso($adif, $qsl)
|
||||
{
|
||||
$this->load->model('eqslmethods_model');
|
||||
$status = "";
|
||||
|
||||
|
|
@ -228,10 +237,12 @@ class eqsl extends CI_Controller {
|
|||
$this->eqslmethods_model->eqsl_mark_sent($qsl['COL_PRIMARY_KEY']);
|
||||
} else {
|
||||
if (stristr($result, "Error: No match on eQSL_User/eQSL_Pswd")) {
|
||||
$this->session->set_flashdata('warning', 'Your eQSL username and/or password is incorrect.'); redirect('eqsl/export');
|
||||
$this->session->set_flashdata('warning', 'Your eQSL username and/or password is incorrect.');
|
||||
redirect('eqsl/export');
|
||||
} else {
|
||||
if (stristr($result, "Result: 0 out of 0 records added")) {
|
||||
$this->session->set_flashdata('warning', 'Something went wrong with eQSL.cc!'); redirect('eqsl/export');
|
||||
$this->session->set_flashdata('warning', 'Something went wrong with eQSL.cc!');
|
||||
redirect('eqsl/export');
|
||||
} else {
|
||||
if (stristr($result, "Bad record: Duplicate")) {
|
||||
$status = "Duplicate";
|
||||
|
|
@ -244,14 +255,17 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
} else {
|
||||
if ($chi['http_code'] == "500") {
|
||||
$this->session->set_flashdata('warning', 'eQSL.cc is experiencing issues. Please try exporting QSOs later.'); redirect('eqsl/export');
|
||||
$this->session->set_flashdata('warning', 'eQSL.cc is experiencing issues. Please try exporting QSOs later.');
|
||||
redirect('eqsl/export');
|
||||
} else {
|
||||
if ($chi['http_code'] == "400") {
|
||||
$this->session->set_flashdata('warning', 'There was an error in one of the QSOs. You might want to manually upload them.'); redirect('eqsl/export');
|
||||
$this->session->set_flashdata('warning', 'There was an error in one of the QSOs. You might want to manually upload them.');
|
||||
redirect('eqsl/export');
|
||||
$status = "Error";
|
||||
} else {
|
||||
if ($chi['http_code'] == "404") {
|
||||
$this->session->set_flashdata('warning', 'It seems that the eQSL site has changed. Please open up an issue on GitHub.'); redirect('eqsl/export');
|
||||
$this->session->set_flashdata('warning', 'It seems that the eQSL site has changed. Please open up an issue on GitHub.');
|
||||
redirect('eqsl/export');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -260,7 +274,8 @@ class eqsl extends CI_Controller {
|
|||
return $status;
|
||||
}
|
||||
|
||||
function generateResultTable($custom_date_format, $rows) {
|
||||
function generateResultTable($custom_date_format, $rows)
|
||||
{
|
||||
$table = '<table = style="width:100%" class="table-sm table table-bordered table-hover table-striped table-condensed text-center">';
|
||||
$table .= "<thead><tr class=\"titles\">";
|
||||
$table .= "<th>Date</th>";
|
||||
|
|
@ -279,9 +294,10 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
|
||||
// Build out the ADIF info string according to specs https://eqsl.cc/qslcard/ADIFContentSpecs.cfm
|
||||
function generateAdif($qsl, $data) {
|
||||
$COL_QSO_DATE = date('Ymd',strtotime($qsl['COL_TIME_ON']));
|
||||
$COL_TIME_ON = date('Hi',strtotime($qsl['COL_TIME_ON']));
|
||||
function generateAdif($qsl, $data)
|
||||
{
|
||||
$COL_QSO_DATE = date('Ymd', strtotime($qsl['COL_TIME_ON']));
|
||||
$COL_TIME_ON = date('Hi', strtotime($qsl['COL_TIME_ON']));
|
||||
|
||||
# Set up the single record file
|
||||
$adif = "https://www.eqsl.cc/qslcard/importADIF.cfm?";
|
||||
|
|
@ -359,7 +375,7 @@ class eqsl extends CI_Controller {
|
|||
$adif .= $qsl['COL_MODE'];
|
||||
$adif .= "%20";
|
||||
|
||||
if(isset($qsl['COL_SUBMODE'])) {
|
||||
if (isset($qsl['COL_SUBMODE'])) {
|
||||
$adif .= "%3C";
|
||||
$adif .= "SUBMODE";
|
||||
$adif .= "%3A";
|
||||
|
|
@ -389,7 +405,7 @@ class eqsl extends CI_Controller {
|
|||
$adif .= "%20";
|
||||
|
||||
// adding prop mode if it isn't blank
|
||||
if ($qsl['COL_PROP_MODE']){
|
||||
if ($qsl['COL_PROP_MODE']) {
|
||||
$adif .= "%3C";
|
||||
$adif .= "PROP%5FMODE";
|
||||
$adif .= "%3A";
|
||||
|
|
@ -400,7 +416,7 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
|
||||
// adding sat name if it isn't blank
|
||||
if ($qsl['COL_SAT_NAME'] != ''){
|
||||
if ($qsl['COL_SAT_NAME'] != '') {
|
||||
$adif .= "%3C";
|
||||
$adif .= "SAT%5FNAME";
|
||||
$adif .= "%3A";
|
||||
|
|
@ -411,7 +427,7 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
|
||||
// adding sat mode if it isn't blank
|
||||
if ($qsl['COL_SAT_MODE'] != ''){
|
||||
if ($qsl['COL_SAT_MODE'] != '') {
|
||||
$adif .= "%3C";
|
||||
$adif .= "SAT%5FMODE";
|
||||
$adif .= "%3A";
|
||||
|
|
@ -422,18 +438,18 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
|
||||
// adding qslmsg if it isn't blank
|
||||
if ($qsl['COL_QSLMSG'] != ''){
|
||||
$qsl['COL_QSLMSG'] = str_replace(array(chr(10),chr(13)),array(' ',' '),$qsl['COL_QSLMSG']);
|
||||
if ($qsl['COL_QSLMSG'] != '') {
|
||||
$qsl['COL_QSLMSG'] = str_replace(array(chr(10), chr(13)), array(' ', ' '), $qsl['COL_QSLMSG']);
|
||||
$adif .= "%3C";
|
||||
$adif .= "QSLMSG";
|
||||
$adif .= "%3A";
|
||||
$adif .= strlen($qsl['COL_QSLMSG']);
|
||||
$adif .= "%3E";
|
||||
$adif .= str_replace('&','%26',$qsl['COL_QSLMSG']);
|
||||
$adif .= str_replace('&', '%26', $qsl['COL_QSLMSG']);
|
||||
$adif .= "%20";
|
||||
}
|
||||
|
||||
if ($qsl['eqslqthnickname'] != ''){
|
||||
if ($qsl['eqslqthnickname'] != '') {
|
||||
$adif .= "%3C";
|
||||
$adif .= "APP%5FEQSL%5FQTH%5FNICKNAME";
|
||||
$adif .= "%3A";
|
||||
|
|
@ -444,7 +460,7 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
|
||||
// adding sat mode if it isn't blank
|
||||
if ($qsl['station_gridsquare'] != ''){
|
||||
if ($qsl['station_gridsquare'] != '') {
|
||||
$adif .= "%3C";
|
||||
$adif .= "MY%5FGRIDSQUARE";
|
||||
$adif .= "%3A";
|
||||
|
|
@ -465,7 +481,8 @@ class eqsl extends CI_Controller {
|
|||
return $adif;
|
||||
}
|
||||
|
||||
function writeEqslNotSent($qslsnotsent, $custom_date_format) {
|
||||
function writeEqslNotSent($qslsnotsent, $custom_date_format)
|
||||
{
|
||||
$table = '<table = style="width:100%" class="table-sm table qsotable table-bordered table-hover table-striped table-condensed text-center">';
|
||||
$table .= "<thead><tr class=\"titles\">";
|
||||
$table .= "<th>Date</th>";
|
||||
|
|
@ -477,22 +494,21 @@ class eqsl extends CI_Controller {
|
|||
$table .= "<th>eQSL QTH Nickname</th>";
|
||||
$table .= "</tr></thead><tbody>";
|
||||
|
||||
foreach ($qslsnotsent as $qsl)
|
||||
{
|
||||
foreach ($qslsnotsent as $qsl) {
|
||||
$table .= "<tr>";
|
||||
$timestamp = strtotime($qsl['COL_TIME_ON']);
|
||||
$table .= "<td>".date($custom_date_format, $timestamp)."</td>";
|
||||
$table .= "<td>".date('H:i', $timestamp)."</td>";
|
||||
$table .= "<td><a href=\"javascript:displayQso(" . $qsl['COL_PRIMARY_KEY'] . ")\">" . str_replace("0","Ø",strtoupper($qsl['COL_CALL'])) . "</a></td>";
|
||||
$table .= "<td>".$qsl['COL_MODE']."</td>";
|
||||
$table .= "<td>" . date($custom_date_format, $timestamp) . "</td>";
|
||||
$table .= "<td>" . date('H:i', $timestamp) . "</td>";
|
||||
$table .= "<td><a href=\"javascript:displayQso(" . $qsl['COL_PRIMARY_KEY'] . ")\">" . str_replace("0", "Ø", strtoupper($qsl['COL_CALL'])) . "</a></td>";
|
||||
$table .= "<td>" . $qsl['COL_MODE'] . "</td>";
|
||||
|
||||
if(isset($qsl['COL_SUBMODE'])) {
|
||||
$table .= "<td>".$qsl['COL_SUBMODE']."</td>";
|
||||
if (isset($qsl['COL_SUBMODE'])) {
|
||||
$table .= "<td>" . $qsl['COL_SUBMODE'] . "</td>";
|
||||
} else {
|
||||
$table .= "<td></td>";
|
||||
}
|
||||
$table .= "<td>".$qsl['COL_BAND']."</td>";
|
||||
$table .= "<td>".$qsl['eqslqthnickname']."</td>";
|
||||
$table .= "<td>" . $qsl['COL_BAND'] . "</td>";
|
||||
$table .= "<td>" . $qsl['eqslqthnickname'] . "</td>";
|
||||
$table .= "</tr>";
|
||||
}
|
||||
$table .= "</tbody></table>";
|
||||
|
|
@ -500,11 +516,12 @@ class eqsl extends CI_Controller {
|
|||
return $table;
|
||||
}
|
||||
|
||||
function image($id) {
|
||||
function image($id)
|
||||
{
|
||||
$this->load->library('electronicqsl');
|
||||
$this->load->model('Eqsl_images');
|
||||
|
||||
if($this->Eqsl_images->get_image($id) == "No Image") {
|
||||
if ($this->Eqsl_images->get_image($id) == "No Image") {
|
||||
$this->load->model('logbook_model');
|
||||
$this->load->model('user_model');
|
||||
$qso_query = $this->logbook_model->get_qso($id);
|
||||
|
|
@ -532,34 +549,33 @@ class eqsl extends CI_Controller {
|
|||
$dom->preserveWhiteSpace = false;
|
||||
$images = $dom->getElementsByTagName('img');
|
||||
|
||||
if(!isset($images) || count($images) == 0) {
|
||||
if (!isset($images) || count($images) == 0) {
|
||||
echo "Rate Limited";
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach ($images as $image)
|
||||
{
|
||||
foreach ($images as $image) {
|
||||
header('Content-Type: image/jpg');
|
||||
$content = file_get_contents("https://www.eqsl.cc".$image->getAttribute('src'));
|
||||
$content = file_get_contents("https://www.eqsl.cc" . $image->getAttribute('src'));
|
||||
if ($content === false) {
|
||||
echo "No response";
|
||||
exit;
|
||||
}
|
||||
echo $content;
|
||||
$filename = uniqid().'.jpg';
|
||||
if (file_put_contents('images/eqsl_card_images/' . '/'.$filename, $content) !== false) {
|
||||
$filename = uniqid() . '.jpg';
|
||||
if (file_put_contents('images/eqsl_card_images/' . '/' . $filename, $content) !== false) {
|
||||
$this->Eqsl_images->save_image($id, $filename);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: image/jpg');
|
||||
$image_url = base_url('images/eqsl_card_images/'.$this->Eqsl_images->get_image($id));
|
||||
$image_url = base_url('images/eqsl_card_images/' . $this->Eqsl_images->get_image($id));
|
||||
header('Location: ' . $image_url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function bulk_download_image($id) {
|
||||
function bulk_download_image($id)
|
||||
{
|
||||
$this->load->library('electronicqsl');
|
||||
$this->load->model('Eqsl_images');
|
||||
|
||||
|
|
@ -595,31 +611,33 @@ class eqsl extends CI_Controller {
|
|||
$dom->preserveWhiteSpace = false;
|
||||
$images = $dom->getElementsByTagName('img');
|
||||
|
||||
if(!isset($images) || count($images) == 0) {
|
||||
if (!isset($images) || count($images) == 0) {
|
||||
$error = "Rate Limited";
|
||||
return $error;
|
||||
}
|
||||
|
||||
foreach ($images as $image)
|
||||
{
|
||||
$content = file_get_contents("https://www.eqsl.cc".$image->getAttribute('src'));
|
||||
foreach ($images as $image) {
|
||||
$content = file_get_contents("https://www.eqsl.cc" . $image->getAttribute('src'));
|
||||
if ($content === false) {
|
||||
$error = "No response";
|
||||
return $error;
|
||||
}
|
||||
$filename = uniqid().'.jpg';
|
||||
if (file_put_contents('images/eqsl_card_images/' . '/'.$filename, $content) !== false) {
|
||||
$filename = uniqid() . '.jpg';
|
||||
if (file_put_contents('images/eqsl_card_images/' . '/' . $filename, $content) !== false) {
|
||||
$this->Eqsl_images->save_image($id, $filename);
|
||||
}
|
||||
}
|
||||
return $error;
|
||||
|
||||
}
|
||||
|
||||
public function tools() {
|
||||
public function tools()
|
||||
{
|
||||
// Check logged in
|
||||
$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'); }
|
||||
if (!$this->user_model->authorize(2)) {
|
||||
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
|
||||
redirect('dashboard');
|
||||
}
|
||||
|
||||
$data['page_title'] = "eQSL Tools";
|
||||
|
||||
|
|
@ -629,11 +647,15 @@ class eqsl extends CI_Controller {
|
|||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function download() {
|
||||
public function download()
|
||||
{
|
||||
// Check logged in
|
||||
$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'); }
|
||||
$errors=0;
|
||||
if (!$this->user_model->authorize(2)) {
|
||||
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
|
||||
redirect('dashboard');
|
||||
}
|
||||
$errors = 0;
|
||||
|
||||
if ($this->input->post('eqsldownload') == 'download') {
|
||||
$i = 0;
|
||||
|
|
@ -665,7 +687,7 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
}
|
||||
$data['eqsl_results'] = $eqsl_results;
|
||||
$data['eqsl_stats'] = "Successfully downloaded: ".$i." / Errors: ".count($eqsl_results);
|
||||
$data['eqsl_stats'] = "Successfully downloaded: " . $i . " / Errors: " . count($eqsl_results);
|
||||
$data['page_title'] = "eQSL Download Information";
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
|
|
@ -685,10 +707,14 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
public function mark_all_sent() {
|
||||
public function mark_all_sent()
|
||||
{
|
||||
// Check logged in
|
||||
$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'); }
|
||||
if (!$this->user_model->authorize(2)) {
|
||||
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
|
||||
redirect('dashboard');
|
||||
}
|
||||
|
||||
// mark all eqsls as sent
|
||||
$this->load->model('eqslmethods_model');
|
||||
|
|
@ -702,7 +728,8 @@ class eqsl extends CI_Controller {
|
|||
/*
|
||||
* Used for CRON job
|
||||
*/
|
||||
public function sync() {
|
||||
public function sync()
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
set_time_limit(0);
|
||||
$this->load->model('eqslmethods_model');
|
||||
|
|
@ -715,7 +742,8 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
public function downloadUser($userid, $username, $password) {
|
||||
public function downloadUser($userid, $username, $password)
|
||||
{
|
||||
$this->load->library('EqslImporter');
|
||||
$this->load->model('eqslmethods_model');
|
||||
|
||||
|
|
@ -736,7 +764,8 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
function uploadUser($userid, $username, $password) {
|
||||
function uploadUser($userid, $username, $password)
|
||||
{
|
||||
$data['user_eqsl_name'] = $this->security->xss_clean($username);
|
||||
$data['user_eqsl_password'] = $this->security->xss_clean($password);
|
||||
$clean_userid = $this->security->xss_clean($userid);
|
||||
|
|
|
|||
正在加载…
在新工单中引用